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

Stage and Death Leaderboard script?

Im looking for a leaderboard script that just uses stages and deaths.Ive tried many things and the leaderboard has shown up but when I touched the spawn it didn't change the stage.

Can anyone help me?

3 comments

0

Can you include the script

0

@kingdom5 i don't think he has one.

0

@dadcrazy101, Are you making an obby? Just saying

1 answer

This is what might what you were looking for..

game.Players.PlayerAdded:connect(function(Plr) -- Player Joined
	Plr.CharacterAdded:connect(function(Char) -- Players' Character Added
		-- Setting Variables
		local ldrstats = Instance.new("StringValue",Plr)-- Creating Leaderstats
		ldrstats.Name = "Leaderstats"
		local stge = Instance.new("IntValue", ldrstats)-- Creating Stage Value
		stge.Name = "Stage"
		stge.Value = 1
		local dths = Instance.new("IntValue", ldrstats) -- Creating Death Value
		dths.Name = "Deaths"
		dths.Value = 0
		
		-- Player died
		Char:WaitForChild("Humanoid").Died:connect(function() -- Finding if Player Died
			dths.Value = dths.Value + 1 -- Add one Death
		end)
	end)
end)

Have a Stage Part with a script and a value that the VALUE has the stage number.

In The Script:

script.Parent.Touched:connect(function(Hit) -- Part is Touched
	local PlrN = Hit.Parent.Name -- Get Player Name Who Touched
	local Plr = game.Players:FindFirstChild(PlrN) -- Find Player in Players with the Name
	if Plr then -- If script have found the Player
		local Ldrs = Plr:FindFirstChild("Leaderstats") -- Find Leaderstats in Player
		if Ldrs then -- If Leaderstats is found
			local Stage = Ldrs:FindFirstChild("Stage") -- Find Stage in Leaderstats
			if Stage then -- If Stage is found
				local StageV = script.Parent.Stage -- Variable for the Value to make sure players are not skipping stages
				if Stage.Value == StageV.Value then -- If their *SUPPOSED* stage is correct with the Stage Value
					Stage.Value = Stage.Value + 1 -- Add One to the players' Stage value
				end
			end
		end
	end
end)

2 comments

0

Yes I am making an obby @thesit123.I tried using the script but no leaderboard shows up.Do I need to insert it into Serverscript storage or something like that.Do I have to put it in an existing leaderboard

0

@dadcrazy101, Change the Instance type from Folder to "Configuration" for Leaderstats. sorry to keep you waiting.

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