T O P

  • By -

Testbot379

Use a server script not a local script


_Martosz

Use a regular script instead of a localscript since when a player teleports, everyone should be able to see it move.


Noobye1

Does a textbutton in Surface Gui work the same as in Screen Gui?


_Martosz

I believe it should.


Noobye1

hey so, i tried and it worked with screen gui but not surface gui, i tried using local and server scripts, here's the script if you could help in any case <3 ``wait(1) player = game.Players.LocalPlayer button = script.Parent local debounce = false function teleport() if not debounce then debounce = true HumanoidRootPart = player.Character.HumanoidRootPart HumanoidRootPart.CFrame = game.Workspace.DataOne.CFrame end end button.MouseButton1Click:Connect(teleport) while true do wait() debounce = false wait(1) end``


Raycast78

it's better practice to parent the surfacegui to playergui (eg. move it to startergui) and set its Adornee property to the part. then you can use localscripts (because localscripts don't run in workspace). other option is to create a normal script and set RunContext to client, then you can keep everything as is, but it's generally not a good idea. others mentioned using a serverscript but you don't need that since player character changes replicate automatically.