#Trouble with stage number going up
28 messages · Page 1 of 1 (latest)
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
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"?
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*
that made it so that instead of stage it says value
hmm+
** You are now Level 3! **
oh i forgot
the code you had forgot " money.name = "stage" "
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
the number is not going up
** You are now Level 1! **
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