Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

PlayerAdded CFrame stuff. pls help?

game.Players.PlayerAdded:Connect(function()
	game.Workspace:WaitForChild(game.Players.LocalPlayer.Name)
    wait(.1)
    game.Players.LocalPlayer.Character.Torso.CFrame = 
    game.Workspace[game.Players.LocalPlayer.leaderstats.Stage.Value].CC.CFrame
end)

When i tested it in my obby, when i spawned in i didn't teleport to for example stage 0 when i just join, instead i just spawn high up in the middle of the baseplate. But when resetting i spawn on the checkpoint (stage).

This is a localscript inside workspace, im really confused how this isn't working. Already have everything else setup like stages, teleport to them when they die/respawn.

2 comments

0

You cant write, game.Players.LocalPlayer, In a normal script.

0

bro read, i said localscript at the bottom.

1 answer

✓ Accepted answer

If its a localscript then this will do:

local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
local character = player.Character
    wait(.1)
character.Torso.CFrame = 
game.Workspace:FindFirstChild(player.leaderstats.Stage.Value).CC.CFrame

If you want it in a serverscript, just do this:

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
	wait(.1)
	character.Torso.CFrame
game.Workspace:FindFirstChild(player.leaderstats.Stage.Value).CC.CFrame
end)
end)

Tell me if these helped!

2 comments

0

Tysm! :D

0

Np!

This discussion is preserved as it was. New answers, comments, and votes are closed.