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

how to teleport player after he clicks the button but i got a error attempt to index nil with torso?

i want to teleport a player after he clixks the button this is my script

script.parent.MouseButto1Click:Connect(function(player)

player.Torso.CFrame = CFrame.new (--Position)

end)

1 answer

✓ Accepted answer

Yo Try to use this script If your button is in startergui, then add the localscript inside button then use this script

local player = game.Players.LocalPlayer
script.parent.MouseButton1Click:Connect(function()

player.Character.HumanoidRootPart.CFrame = CFrame.new(--position)
end)

but if it on the part I recommend to use clickdetector, insert this script to clickdetector

script.Parent.MouseClick:Connect(function(plr)
plr.Character.HumanoidRootPart.CFrame = CFrame.new(--position)
end)

I hope this helps!

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