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

LeaderBoard Wins, Won't Be Updated, Any Help?

Asked by 5 years ago

So I Have done Some Parkour, And When You Reach the End, You Get + 1 Win, For Some Players, It Works, But For Some It Doesn't, It Doesn't Count as a Win or It Gives The Win To Someone Else, Any Help?

local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("winsSaveSystem")--change all "wins" to what value you want and keep doing it 
local Debounce = tick() -- Assign tick() to the variable
game.Players.PlayerAdded:Connect(function(player)
 local folder = Instance.new("Folder", player)
 folder.Name = "leaderstats"
 local wins = Instance.new("IntValue", folder)
 wins.Name = "Wins"
 wins.Value = ds1:GetAsync(player.UserId) or 0
 ds1:SetAsync(player.UserId, wins.Value)

workspace.Lobby.DROPDOWN.Winner.Touched:Connect(function()
    if (tick() - Debounce) >= 2 then -- Make sure 5 seconds have elapsed since last debounce
        Debounce = tick()
            wins.Value = wins.Value + 1


    end
end)



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



end)
0
im going to say this for the 3rd time. dont save wins to the datastore everytime they change Gey4Jesus69 2705 — 5y
0
But How I Should not Save Them? Write A Code Or Something BloxEnergy -76 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You have been suspended so what's point in helping if you can't even read this?

Ad

Answer this question