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!

7 comments

0

remove the extra o in HumanooidRootPart

0

sorry, cuz I accidentally write that in the question

0

in my actual script there isn't

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

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.

0

Your problem is that variables are case-sensitive. You defined the local player as "player" then tried to set the CFrame of "Player"

0

uhh, can you please explain what is case sensitive? And how should I fix it? Like replace and expand the variables?