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

How can I save people's KO's and WO's in the leaderboard?

Asked by 9 years ago

I would like to know how to save player's KO's and WO's in the leaderboards so that it appears the next time they come?

Thank you!

1 answer

Log in to vote
0
Answered by 9 years ago

Do you know how to make the leaderboard? Do you know how your leaderboard works? If so then this should work.

I will give you a simple .Touched script that you can play around and soon put it into a Gui or maybe even a .Chatted format. Whatever you'd like.

    function OnTouchSave(plr) -- Plr is the part that hit the brick. I named it plr (short for player) knowing it is for players only.

    if plr.Parent:findFirstChild("Humanoid") ~= nil then    
Player = game.Players:GetPlayerFromCharacter(plr.Parent)
Player:WaitForDataReady()
    if Player.leaderstats.KOs ~= 0 then -- So you don't save a nil number. That would be stupid.
    Player:SaveNumber("KOs", Player.leaderstats.KOs.Value)

    end
        end
            end
script.Parent.Touched:connect(OnTouchSave)
0
Hmm looks like my script derped. legoguy939 418 — 9y
0
Fixed it. Just replace "KOs" with whatever your leaderstats are called. Copy paste the part where I check to see if KOs is not equal to nil and you can make one for WOs too. If you're using linked leaderboard I don't recommend this. I'd look into Data Persistence a little more. legoguy939 418 — 9y
0
Just a side note. You'll need to be in the game (NOT IN EDIT MODE) for this to work. legoguy939 418 — 9y
0
Where do I put the script? Workspace? I did, but it didn't work. DrCylonide 158 — 9y
0
Uh. No I said it is a .Touched script. You put it in a brick and put the brick in workspace. legoguy939 418 — 9y
Ad

Answer this question