#Trouble with stage number going up

28 messages · Page 1 of 1 (latest)

steady lava
#

I am making an obby and I am stuggling with getting the stage number to go up on the leader board. I have it tell you that you are on first stage. And it won't go up.

spring quarry
#

function onTouched(part)
local name = script.Parent.Name
local h = part.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local char = h.Parent
local player = char:GetPlayerFromCharacter(char)
if player ~= nil then
local leaderstats = player.FindFirstChild("leaderstats")
if leaderstats ~= nil then
local stage = leaderboard:FindFirstChild("Stage")
if stage ~= nil then
stage.Value = name
end
end
end
end
end
script.Parent.Touched:Connect(onTouched)

#

try this

steady lava
#

that didnt work

#

but the wierd thing is is that it only works on stage two for both code

#

could it be that is says "leaderboard" when the first code says "leaderstats"?

spring quarry
#

both are named as leaderstats

#

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local money = Instance.new("IntValue")
money.Value += 1
money.Parent = leaderstats
end)

#

this should add a +1 when touched the aprt

#

part*

steady lava
#

that made it so that instead of stage it says value

spring quarry
#

hmm+

junior radishBOT
#

studio** You are now Level 3! **studio

spring quarry
#

oh i forgot

steady lava
spring quarry
#

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local money = Instance.new("IntValue")
money.Name = "stage"
money.Value += 1
money.Parent = leaderstats
end)

#

yeah yeah

#

try that

steady lava
#

the number is not going up

junior radishBOT
#

studio** You are now Level 1! **studio

steady lava
#

my studio just crashed

#

I don't understand why this dosen't work and I'm not much of a coder. My guess could be the checkpoint script.

#

Someone had told me before that I need to have "local name = tonumber(script.Parent.Name)" and not "local name = script.Parent.Name" becaus the name is "3" and it gets put as a string and not a number

#

I just tried this and it didn’t work

spring quarry
#

im sorry but I cant help you anymore

#

I have no idea why it happens

haughty quail
#

you realize indentation exists for a reason