Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Data Storing Doesn't Update For Some Players On My Game, Why?

Asked by
TheRob666 -54
5 years ago
Edited 5 years ago

I Have Tested My Game, In Roblox Studio And It Works Perfectly, Even In The Roblox Itself, The Problem Is For some Players When They Reach The Finish They Won't Get Any Point, Or The Point Will Be Given To Any Other Player, Why?

print("starting")
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("CashSaveSystem")

game.Players.PlayerAdded:Connect(function(player)
 local folder = Instance.new("Folder", player)
 folder.Name = "leaderstats"
 local wins = Instance.new("IntValue", folder)
 Finished.Name = "Finished"
 Finished.Value = ds1:GetAsync(player.UserId) or 0
 ds1:SetAsync(player.UserId, Finished.Value)

workspace.FinishPart.Touched:Connect(function()
            Finished.Value = Finished.Value + 1


    end
end)



 wins.Changed:Connect(function()
  ds1:SetAsync(player.UserId, Finished.Value)
 end)



end)

Answer this question