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

How do I access the leaderboard and change the deaths in a function?

I made a script that changes someone's team if they are in a group and resets them so that they spawn in the right place but it adds a wipeout to their leaderboard. How do I access the leaderboard and subtract 1 in the function after i reset them?

1 answer

You do not access the leaderboard, you create the leaderboard.

Leaderboards are made by creating an IntValue named "leaderstats" inside of the player, then inserting all other stats, such as NumberValues for Kills and Deaths inside of the leaderstats.

You can figure that out yourself. As to changing the Deaths when the Player dies, you can use the .Died event.

function humanoidDied(humanoid)
	local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
	if player ~= nil then
		player.Deaths.Value = player.Deaths.Value - 1
	end
end

for i,v in pairs(game.Players:GetChildren()) do --Fires the humanoidDied function for each player
	v.Character.Humanoid.Died:connect(humanoidDied)
end

2 comments

0

No, I don't need to create it, it is already there, I need to access the scripted leaderboard in another script.

0

Then you should probably insert the script you are talking about.

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