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

Why isn't this teleporting the character to its new position?

I have a morph (which becomes the players torso). on the center of the morph (which is the characters torso) I have a click detector and script. It is supposed to teleport the player, once the morph (which is still the characters torso) is clicked, to the given coordinates. Why isn't it teleporting? Are you not able to add click detectors to morphs/players torso?

local player = game.Players.LocalPlayer
local char =player.Character.Torso

function Click() 
	char.CFrame = CFrame.new(Vector3.new(-107.28, 2.88, 90.1))
end 

script.Parent.MouseButton1Down:connect(Click) 

--most of this was taken from somebody else's script--

1 comment

0

You need to tell us the nam e of the part and the click detector and thnigs like that.

2 answers

function Click()																 
	game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(0,0,0) --change to your position
end 
script.Parent.MouseButton1Down:connect(Click)

First, the variables are not needed for this script. Using game.Players.LocalPlayer.Character.Torso.CFrame is easier, or you can use char = game.Players.LocalPlayer.Character.Torso

Second, I have no Idea why you are using Vector3, but the CFrame is correct.

Last, please use your own scripts.

Tip: add 3 digits to the middle number of your CFrame. ( Example: -50,50,-90. The middle number is 50. Add three you got 53 so put that there so you don't glitch out when you teleport there.

Please +1 or accept if this helped!

local Player = game.Players.LocalPlayer 
repeat wait() until
Player.Character--You need to wait for the Character(Unless you're in play solo)
local Char =Player.Character.Torso 
local Mouse=game.Players.LocalPlayer:GetMouse()
function Click()  
    Char.CFrame = CFrame.new(Vector3.new(-107.28, 2.88, 90.1))
end 
Mouse.Button1Down:connect(Click) --Its Button1Down, notMouseButton1Down

It worked well at my place It is a localscript which is in StarterPack (if you press F9 the errors are from a different script.)

1 comment

0

Neither of these worked, thanks though!

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