So I have this script here that teleports a player, but the only issue is, it doesn;t when I play the game; only when I test in studio does it work. It is a regular script and I am not sure what I should try. Anyone have any insight?
script.Parent.MouseButton1Click:connect(function() local TeleportTo = game.Workspace:FindFirstChild("Tp2") local Player = script.Parent.Parent.Parent.Parent local Character = Player.Character local Torso = Character:WaitForChild("Torso") Torso.CFrame = TeleportTo.CFrame * CFrame.new(0,0,20) end)
You can’t use a server (regular) script in GUI like this. Testing solo in studio works because I guess testing mode combines client and server, making your script work in-studio.
I forgot if you can change CFrame on a player with a localscript so change the server script into a localscript, and if that doesn’t work, use RemoteEvents, which you can read about here.