top of page
Search

Open Source Datastore Script (used for reference)

  • Writer: Asporus
    Asporus
  • Aug 9, 2020
  • 1 min read

As the title says, you might not wanna use this exact script so its here for reference! This is a script from one of my old projects, but still works regardless. I admit, its not the most efficient code, but it does the job.



local DataStoreService = game:GetService("DataStoreService")


local StrengthData = DataStoreService:GetDataStore("StrengthData")
local DuraData = DataStoreService:GetDataStore("DuraData")
local AttackSpeedData = DataStoreService:GetDataStore("AttackSpeed")
local SpeedData = DataStoreService:GetDataStore("SpeedData")
local BannedData = DataStoreService:GetDataStore("BData")


game.Players.PlayerAdded:Connect(function(player)
	local Strength = Instance.new("NumberValue",player)
	local Durability = Instance.new("NumberValue",player)
	local AttackSpeed = Instance.new("NumberValue",player)
	local Speed = Instance.new("NumberValue",player)
	local Banned = Instance.new("BoolValue",player)
	local CanRun = Instance.new("BoolValue",player)
	CanRun.Value = true
	CanRun.Name = "CanRun"
 
	Strength.Name = "Strength"
	Durability.Name = "Durability"
	AttackSpeed.Name = "AttackSpeed"
	Speed.Name = "Speed"
	Banned.Name = "Banned"
	Speed.Value = 5
	Banned.Value = false
 
	Strength.Name = "Strength"
	Durability.Name = "Durability"
	AttackSpeed.Name = "AttackSpeed"
	Speed.Name = "Speed"
	Banned.Name = "Banned"
	Speed.Value = 5
 
	if Banned.Value == true then
		player:Kick("Ez.")
	end
 
	Banned.Changed:Connect(function(Ban)
		if Banned.Value == true then
			player:Kick("Failed to save braincells, don't reconnect.")
		end
	end)
 
	game.Players.PlayerRemoving:Connect(function(player)
    	pcall(function()
        	StrengthData:SetAsync(player.UserId.."--Str--"..Strength.Value)
       	 	DuraData:SetAsync(player.UserId.."--Dura--"..Durability.Value)
        	AttackSpeedData:SetAsync(player.UserId.."--AttackSpeed--"..AttackSpeed.Value)
        	SpeedData:SetAsync(player.UserId.."--SpeedData--"..Speed.Value)
        	BannedData:SetAsync(player.UserId.."--BannedData--"..Banned.Value)
    	end)
	end)
end)





 
 
 

Recent Posts

See All
Open Source Run System

This is a running system using the service known as "UserInputService". UserInputService, (abbreviated as UIS), practically detects input...

 
 
 
Open Source Leaderstats Script

Leaderstats are very simple, and most developers that have developed for at least a week have learned them. Some new people, though,...

 
 
 
Open Source Camera Manipulation GUI

For this script, you will need a part named "CamPart" or you can change the variable to your desired part in workspace. Make sure the...

 
 
 

Kommentare


Post: Blog2_Post
  • Facebook
  • Twitter
  • LinkedIn

©2020 by Asporus. Open Source Script Library.

bottom of page