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--
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.)