So I have this datastore but the problem is that it will create a value that I don't want! Help!?
local ds = game:GetService("DataStoreService")
ds1 = ds:GetDataStore("popularity")
ds2 = ds:GetDataStore("boost")
ds3 = ds:GetDataStore("multiplier")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local value = Instance.new("IntValue",leaderstats)
value.Value = ds1:GetAsync(player.UserId) or 0
value.Name = "Popularity" -- Currency Name
local value2 = Instance.new("IntValue",leaderstats)
value2.Value = ds2:GetAsync(player.UserId) or 0
value2.Name = "Boost"
local value3 = Instance.new("IntValue",leaderstats)
value3.Name = "Multiplier"
value3.Value = ds3:GetAsync(player.UserId) or 1
value.Changed:Connect(function()
pcall(function()
ds1:SetAsync(player.UserId,value.Value)
end)
end)
value2.Changed:Connect(function()
pcall(function()
ds2:SetAsync(player.UserId,value2.Value)
end)
end)
value3.Changed:Connect(function()
pcall(function()
ds3:SetAsync(player.UserId,value3.Value)
end)
end)
game.Players.PlayerRemoving:Connect(function()
pcall(function()
ds1:SetAsync(player.UserId,value.Value)
ds2:SetAsync(player.UserId,value2.Value)
ds3:SetAsync(player.UserId,value3.Value)
end)
end)
end)
