local ObbyStages = workspace:WaitForChild(“ObbyStages”)
for _,stage in pairs(ObbyStages:GetChildren()) do
stage.Touched:connect(function(hit)
local hum
if hit.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Humanoid
end
if hit.Parent and hit.Parent.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Parent.Humanoid
end
if hum then local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
local plrstage = plr.leaderstats.Stage.Value
if tonumber(stage.Name) == plrStage + 1 then
plr.leaderstats.Stage.Value = plr.leaderstats.Stage.Value + 1
elseif tonumber(stage.Name) > plrStage + 1 then
hum.Health = 0
end
end
end
connect is deprecated, use Connect. Why is Can someome please help me? in the script? This can be the script:
players.PlayerAdded:Connect(function(plr)
stage.Touched:Connect(function(hit)
--Can someone please help me?
local ObbyStages = workspace:WaitForChild(“ObbyStages”)
for _,stage in pairs(ObbyStages:GetChildren()) do
stage.Touched:connect(function(hit)
local hum
if hit.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Humanoid
end
if hit.Parent and hit.Parent.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Parent.Humanoid
end
if hum then local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
local plrstage = plr.leaderstats.Stage.Value
if tonumber(stage.Name) == plrStage + 1 then
plr.leaderstats.Stage.Value = plr.leaderstats.Stage.Value + 1
elseif tonumber(stage.Name) > plrStage + 1 then
hum.Health = 0
end
end
end
end)
end)
end)
Can you give then the exact script? You said this is your script:
players.PlayerAdded:Connect(function(plr)
stage.Touched:connect(function(hit)
Can someone please help me?
local ObbyStages = workspace:WaitForChild(“ObbyStages”)
for _,stage in pairs(ObbyStages:GetChildren()) do
stage.Touched:connect(function(hit)
local hum
if hit.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Humanoid
end
if hit.Parent and hit.Parent.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Parent.Humanoid
end
if hum then local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
local plrstage = plr.leaderstats.Stage.Value
if tonumber(stage.Name) == plrStage + 1 then
plr.leaderstats.Stage.Value = plr.leaderstats.Stage.Value + 1
elseif tonumber(stage.Name) > plrStage + 1 then
hum.Health = 0
end
end
end
local ObbyStages = workspace:WaitForChild(“ObbyStages”)
for _,stage in pairs(ObbyStages:GetChildren()) do
stage.Touched:connect(function(hit)
local hum
if hit.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Humanoid
end
if hit.Parent and hit.Parent.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Parent.Humanoid
end
if hum then local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
local plrstage = plr.leaderstats.Stage.Value
if tonumber(stage.Name) == plrStage + 1 then
plr.leaderstats.Stage.Value = plr.leaderstats.Stage.Value + 1
elseif tonumber(stage.Name) > plrStage + 1 then
hum.Health = 0
end
end
end
local ObbyStages = workspace:WaitForChild(“ObbyStages”)
for _,stage in pairs(ObbyStages:GetChildren()) do
stage.Touched:connect(function(hit)
local hum
if hit.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Humanoid
end
if hit.Parent and hit.Parent.Parent:FindFirstChild("Humanoid") then
hum = hit.Parent.Parent.Humanoid
end)
if hum then local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
local plrstage = plr.leaderstats.Stage.Value
if tonumber(stage.Name) == plrStage + 1 then
plr.leaderstats.Stage.Value = plr.leaderstats.Stage.Value + 1
elseif tonumber(stage.Name) > plrStage + 1 then
hum.Health = 0
end
end)
end)
Please format your code properly (put ``` before and after your code). It’s hard to follow what’s going on, but it seems like you’re missing a parenthesis somewhere, based on the error. Remember to indent, since it makes these kinds of issues easier to spot.