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

I'm teleporting a player when the player presses a guibutton, why does this script not work?

teleportposition = CFrame.new(-17.93, 0.5, 360.89)

script.Parent.MouseButton1Click:Connect(function(clicked)
	if clicked.Character:FindFirstChild("Humanoid") then
	clicked.Character.HumanoidRootPart.CFrame =  teleportposition
	end
end)

1 answer

Use LocalScript

script.Parent.MouseButton1Click:Connect(function()
	local player = game.Players.LocalPlayer
    if player.Character:FindFirstChild("Humanoid") then
    player.Character.HumanoidRootPart.CFrame =  CFrame.new(-17.93, 0.5, 360.89)
    end
end)

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