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

How would I make it so that if XP reaches a surtent value, it will award a rank?

Hi. I have made a rank system but I can't find a proper way to make it award a rank with XP. (Yes, experience is NOT located in leaderstats since it's meant to be hidden.) Here is my code, please help!

for i, v in pairs(game.Players:GetPlayers()) do
	if v.experience.Value == 50 then
		v.leaderstats.Rank.Value = 'Private'
	end
end

5 comments

0

thats only gonna run once :/

0

Ok, how to fix it? :/

0

maybe run it when a player ranks up?

0

how?

0

GetPropertyChangedSignal?

2 answers

Use :GetPropertyChangedSignal("Value", instance) on the XP value.

Documentation

In the future, please provide more code. I.E your full leaderstats script or XP system. If this helped, mark it as a solution!

Next time please provide more code.

game.Players.PlayerAdded:Connect(function(player)--Fired when the player is added into the game
	local Experience = player:WaitForChild("experience")--The Experience variable
	local Rank = player:WaitForChild("leaderstats"):WaitForChild("Rank")--The Rank variable
	Experience.Changed:Connect(function()--Fired when the value is changed
		if Experience.Value == 50 then--Checks if the Experience is equal to 50
			Rank.Value = "Private"--Rank is now set to Private
		end
	end)
end)

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