I've tried many ways around it, and in this sample I have my most recent attempt.
game.Players.PlayerAdded:connect(function(plr)
local stat = Instance.new("Model")
stat.Name = "leaderstats"
stat.Parent = plr
print(stat.Parent)
local stat2 = Instance.new("NumberValue")
stat2.Name = "Stage"
stat2.Parent = stat
print(stat2.Parent)
end)
for i,v in pairs(game.Workspace:GetChildren()) do
if v.ClassName == "Part" then
if v:FindFirstChild('Value') then
print(v.Value.Value)
game.Players.PlayerAdded:connect(function()
v.Name = ("Spawn" .. v.Value.Value)
end)
v.Touched:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
if hit.Parent.Humanoid.Health ~= 0 then
if v.Value.Value == game.Players.LocalPlayer.leaderstats.Stage.Value+1 then
game.Players.LocalPlayer.leaderstats.Stage.Value = v.Value.Value
if v.Value == game.Players.LocalPlayer.leaderstats.Stage.Value then
game.Players.LocalPlayer.CharacterAdded:connect(function(chr)
wait(0.1)
game.Players.LocalPlayer.Character:MoveTo(v.Position+Vector3.new(0, 3, 0))
end)
end
end
end
end
end)
end
end
end
I am attempting to get the game to wait for the character to load and it to the spawn. (as seen line 23 - 28)
