You can read the comments at the end of the script(where the statement didn't work) for more information, no errors. It doesn't print anything even when the player has stage 2.
enabled = true n = script.Parent script.Parent.Touched:Connect(function(part) if part.Parent:FindFirstChild("Humanoid") and enabled == true then local plr = game.Players[part.Parent.Name] local stats = plr.leaderstats local stage = stats.Stage if stage.Value == n.Name-1 then stage.Value = (n.Name) end end end) -- above is working fine game.Players.PlayerAdded:Connect(function(player) wait(0.25) -- cant do waitforchild cause it causes infininte yeilds all the time local stats = player.leaderstats local character = player.Character local stage = stats.Stage print(stats.Name.." loaded") -- This loaded print(stage.Name.." loaded") -- This loaded too wait() if stage.Value == n.Name then -- This doesn't work! Plus n.Name is "2" print("test sdas") -- This doesn't print! EVEN if the player has stage 2! character.HumanoidRootPart.CFrame = CFrame.new(n.Position) end end)
I think I found your error:
if stage.Value == n.Name then
You are trying to compare a number with a string, and that will always return false.
Try:
if stage.Value == tonumber(n.Name) then --your code. end
And if you are wondering why it does work here:
if stage.Value == n.Name-1 then stage.Value = (n.Name) end
That's because when you have a string like "21" and then do a mathmatical operation on it. Roblox will automaticly detect that it is a number and it will continue without error.
I hope this fixed your problem!