this is inside a script that is locaded in a text button in a GUI in a script in server script service

local function onButtonActivated()
	local TeleportService = game:GetService("TeleportService")
	local place = 4944349183
	
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		TeleportService:Teleport(place, player)
	end
end
button.Activated:Connect(onButtonActivated)

first off it trys to teleport you when you join second i had this error ServerScriptService.thing.GUI.TextButton.Script:10: attempt to index nil with 'Activated'

2 comments

0

There should only be scripts in the ServerScriptService, the "button" may be removed automatically by the system, try storing the gui in ServerStorage instead

0

thanks but thats there for a reason becuase its a gui that only pops up if you have a gamepass