of     1   

BrandonCpatrick
#63545087Monday, February 27, 2012 9:51 PM GMT

Alright so I have my gui where when you pick one of the options it teleports you to a spawn. How do I make it so when you clicked one of the options or w/e it will then close and not come back up? Thank you for your help!
TC8950
#63545551Monday, February 27, 2012 10:00 PM GMT

function onButtonClicked() script.Parent.Parent.Parent:Remove() end script.Parent.MouseButton1Down:connect(onButtonClicked) Guessing that your button is in a frame and your frame is in a ScreenGUI
epicfail22
#63548319Monday, February 27, 2012 10:52 PM GMT

You could do this for teleporting to a random spawn. script.Parent.MouseButton1Click:connect(function() local Spawns = {} for k,v in pairs(game.Workspace:GetChildren()) do if v:IsA("SpawnLocation") then Spawns[#Spawns+1] = v.Position end end pcall(function() script.Parent.Parent.Parent.Parent.Character:MoveTo(Spawns[math.random(1,#Spawns)]) end) end)
BrandonCpatrick
#63560954Tuesday, February 28, 2012 2:14 AM GMT

Well I have it set teleporting to coordinates above the spawns;I have the teleport gui's working, I just need to make it so it disapears after you click one. and it wont come back unless you re-enter the game.
TelamonLikenoname
#63561240Tuesday, February 28, 2012 2:19 AM GMT

@epic what does pcall do?
AdamantTale
#63561308Tuesday, February 28, 2012 2:20 AM GMT

pcall: basicaly a function, where if it errors, do something else. Commonly used in Data Persistence.
BrandonCpatrick
#63666889Thursday, March 01, 2012 9:00 PM GMT

Thanks it worked but how would i change this script so it ends AFTER i have been teleported. I also dont want it popping up every time i did only the first time! Thanks! function Click() script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(18.5, 1, 30.5)end script.Parent.MouseButton1Down:connect(Click) function onButtonClicked() script.Parent.Parent.Parent:Remove() end script.Parent.MouseButton1Down:connect(onButtonClicked)
hyrumcoop
#63669226Thursday, March 01, 2012 9:44 PM GMT

If I understand what you are trying to say, this will fix it. function Click() script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(18.5, 1, 30.5) script.Parent.Parent.Parent:Remove() end script.Parent.MouseButton1Down:connect(Click)
epicfail22
#63671024Thursday, March 01, 2012 10:12 PM GMT

@Telamonlikenoname; In this case I just used it to prevent errors. @OP; You'll have to make it in a PlayerAdded event then.

    of     1