Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

5 comments

0

Hmm looks like my script derped.

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.

0

Just a side note. You'll need to be in the game (NOT IN EDIT MODE) for this to work.

0

Where do I put the script? Workspace? I did, but it didn't work.

0

Uh. No I said it is a .Touched script. You put it in a brick and put the brick in workspace.

This discussion is preserved as it was. New answers, comments, and votes are closed.