Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

CFrame Teleporting doesn't work?

Asked by 8 years ago

Hello,

So I got CFrame teleporting and it doesn't work Online. The code is made in "Script". Works in Studio, but not in Online

local Player = game.Players.LocalPlayer
Player.Character.Torso.CFrame = CFrame.new(Vector3.new(-142.6, 49.5, 46))

2 answers

Log in to vote
0
Answered by 8 years ago

I wouldn't use CFrame if I were you. I'd use MoveTo:

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        char:MoveTo(Vector3.new(-142.6, 49.5, 46))
    end
end)
Ad
Log in to vote
2
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

The script loads before the character/torso exist, so you need to wait for them to load.

local Player=game.Players.LocalPlayer
local Character=Player.Character or Player.CharacterAdded:wait()
Character:WaitForChild("Torso").CFrame=CFrame.new(-142.6,49.5,46)
0
Hey, Sadly it doesn't work Online or in Studio. Doesn't show any errors as well Maamees13 5 — 8y
0
Btw, that code comes after "Hint Talk" code Maamees13 5 — 8y
0
The spawn system may be overriding line 3 if you have any SpawnLocations. 1waffle1 2908 — 8y
0
I got 6 Spawn locations. How can I make them to get to SpawnLocations maybe? Without killing them Maamees13 5 — 8y
0
I don't understand what you just said. 1waffle1 2908 — 8y

Answer this question