Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make someone teleport to another game after gui being clicked?

	button = script.Parent 

button.MouseButton1Down:connect(function ()  

	local plrgui = button.Parent.Parent 
	local player = plrgui.Parent
	local id = '443798340' 

		game:GetService('TeleportService'):Teleport(id, player) 
end)

What i want to do is make them teleport to another place when they click it but it doesn't do anything... it's the right place address and even weirder when i click in roblox studio it says cannot teleport to a place that you cant edit (idk what that means)

Thanks

1 answer

✓ Accepted answer
button = script.Parent 
tele = game:GetService('TeleportService')
button.MouseButton1Down:connect(function()  
  	local player = game.Players.LocalPlayer --You don't need to do that stupid parent parent parent stuff, just use localplayer. However, you can't use LocalPlayer in normal scripts.
	tele:Teleport(443798340, player) --this should teleport the player. You had the previous value as a string, when I'm pretty sure it needs to be a number. 
end)

The place you are trying to teleport to, is not owner by you, which means you can not edit it or change anything in it. I.e. The place you are teleporting to is one you can't edit.

If you want to test this, you'll have to test it in a live server

If this works, please don't forget to accept my answer

This discussion is preserved as it was. New answers, comments, and votes are closed.