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

Player teleportation unavailable?

Asked by 3 years ago
Edited 3 years ago

Thanks for your coming. What I am trying to do is teleporting the players using CFrame. I did success with teleporting other object such as a cube, a Santa and a banana. But the problem is that when I tried to teleport my self to a tower, Roblox studio prints:

“Workspace.Script:4: attempt to index nil with ‘Character’”

Here is my code:


target - CFrame.new(0,150,0) player = game.Players.LocalPlayer wait(5) player.Character.HumanoidRootPart.CFrame = target

I have also tried to expand target and player and they still gets error. Could anyone fix this? I have been stuck on this for three days. Thanks!

0
remove the extra o in HumanooidRootPart XxrockatackxX -1 — 3y
0
sorry, cuz I accidentally write that in the question willywillycow 50 — 3y
0
in my actual script there isn't willywillycow 50 — 3y
0
if you're doing it in a localscript it should work perfectly fine else if its a script you should try a remote event or another function depending what you are doing XxrockatackxX -1 — 3y
View all comments (3 more)
0
Can u please tell me what is the difference between a Local script and a script? Cuz I am a newbie and got forced by my friend to code his game. willywillycow 50 — 3y
0
Your problem is that variables are case-sensitive. You defined the local player as "player" then tried to set the CFrame of "Player" WizyTheNinja 834 — 3y
0
uhh, can you please explain what is case sensitive? And how should I fix it? Like replace and expand the variables? willywillycow 50 — 3y

Answer this question