game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) wait(0.1) script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.HumanoidRootPart.CFrame = game.Workspace:FindFirstChild(player.leaderstats.Stage.Value).CC.CFrame end end)
i can't manage to get the actual value of the stage it says that you're on. Instead i currently have it like this for example:
game.Workspace:FindFirstChild("0").CC.CFrame
Please help in any way possible, ty for ur time!
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) wait(0.1) script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.HumanoidRootPart.CFrame = game.Workspace:FindFirstChild(player.leaderstats.Stage.Value).CC.Position end end)
try this
Try this, the problem could be that your stage value is a number and not a string.
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) wait(0.1) script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.HumanoidRootPart.CFrame = game.Workspace:FindFirstChild(tostring(player.leaderstats.Stage.Value)).CC.CFrame end end)
Now if the player is on stage 1 they'll be teleported to a model or part named "1", but you can of course change this if you want.
Why not just use a teleport instead of CFrame? It would be much easier to do especially with.Touched!