Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 8 years ago
    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

Log in to vote
1
Answered by
Async_io 908 Moderation Voter
8 years ago
Edited 8 years ago
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

Ad

Answer this question