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)
COMMUNITY QUESTION
I'm teleporting a player when the player presses a guibutton, why does this script not work?
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.
