So, I have this stage script and it used to work fine but for some reason it doesnt work anymore.
function ot(hit)
if hit.Parent ~= nil then
local player = game.Players:playerFromCharacter(hit.Parent)
if player ~= nil then
if player.leaderstats.Stage.Value == script.Parent.Name - 1 then --This is the line of code that is weird. It doesnt seem like it would work, but it used to. Whats wrong with it, and how do i fix it?
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
if h.Health ~= 0 then
player.leaderstats.Stage.Value = script.Parent.Name
end end end end end end
script.Parent.Touched:connect(ot)

2 comments
Is Name an IntValue?
No, name is just the name of the part. The parts name is 2. This line of code is supposed to tell the game that if your stage is 1 less than this stage, then [code]