It teleports everyone in the server and i want it to teleport only the player that clicks the button, i put it in a Script, i dont know what the problem is. Thank you!
function onClicked()
local p = game.Players:GetChildren() for i = 1, #p do p[i].Character:MoveTo(Vector3.new(510.478, 239.667, -1800.467)) end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
function onClicked(plr) --Finds the player that clicked local pos = CFrame.new(510.478, 239.667, -1800.467) --You can change these numbers to the position you want to teleport the player to. plr.Character.HumanoidRootPart.CFrame = pos end script.Parent.ClickDetector.MouseClick:connect(onClicked)--Conects the function
Hello, you need to understand FILTERING ENABLED, this is VERY VERY IMPORTANT. Use localscript!! Not script!
local button = game.LocalPlayer.PlayerGui.YOURGUI button.MouseButton1Click:Connect(function() game.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(YOUR POSITION) end)