I see you don't understant client and server.
You don't have to tell the client who to teleport because each player has the same script and MouseButton1Down would run if that player clicks it.
Still don't understand?
You can get the local player by doing this local player = game.Players.LocalPlayer
this doesn't work for a serverscript as there is only one server, there are multiple players.
To teleport that player just set his HRP Cframe (HRP = HumanoidRootPart)
You also didn't tell the script what 'Nyes' is so you'll either need script.Parent
or tell it in a variable
Like this
1 | local player = game.Players.LocalPlayer |
2 | local button = script.Parent |
4 | button.MouseButton 1 Down:Connect( function () |
5 | local char = player.Character |
7 | local HRP = char:WaitForChild( 'HumanoidRootPart' ) |
Then you'll have to set the CFrame, you have 2 options
1) Have a part already so you can teleport it to that part
2) Have the Coordinates so you can set it in the script
I'll use the first option
01 | local player = game.Players.LocalPlayer |
02 | local button = script.Parent |
04 | local partTT = workspace:WaitForChild( 'TeleportPart' ) |
06 | button.MouseButton 1 Down:Connect( function () |
07 | local char = player.Character |
09 | local HRP = char:WaitForChild( 'HumanoidRootPart' ) |
10 | HRP.CFrame = partTT.CFrame |
If you want to know the other way...
01 | local player = game.Players.LocalPlayer |
02 | local button = script.Parent |
04 | local pos = CFrame.new(Vector 3. new( 0 , 0 , 0 )) |
05 | button.MouseButton 1 Down:Connect( function () |
06 | local char = player.Character |
08 | local HRP = char:WaitForChild( 'HumanoidRootPart' ) |
If you have any more questions, just ask, please set this as best answer :)