|
I am wondering if there is a way to make a GUI pop open As a Warning Message When a player clicks a Gui to teleport to another place.
|
|
|
Sure. Use TextButtons or ImageButtons. They both have a MouseButton1Click event. When the player clicks the button, change the Visible property of the warning message to true. |
|
|
So like script.Parent.Parent.FRAMENAME.Visible = true?
|
|
|
|
|
s = game:service("TeleportService")
id = ("177156215") --put the number here
function onClicked()
script.Parent.Parent.OJHWarning.Visible = true
wait(10)
s:Teleport(id)
end
script.Parent.MouseButton1Click:connect(onClicked)
Help
|
|
|
Out0fTimeJoin Date: 2015-12-25 Post Count: 13 |
What's the problem? ._. |
|
|
What im trying to do is make a GUI open when toy click a button too teleport to a Sub universe game Basicly.
|
|
|
mityguyJoin Date: 2008-06-07 Post Count: 5483 |
That code you posted ought to work, whats up? Where does it break? |
|
|
All I know is OJH is not a Valid member of Anything
|
|
|
|
|
Dev_RyanJoin Date: 2013-03-10 Post Count: 451 |
Always wait for the frames and stuff to load using :WaitForChild("")
if you try to reference/use it before it is done loading, the script will error.
Try this: (edit where needed)
local frame = script.Parent:WaitForChild("FRAME NAME") -- change to your frame to make visible
local teleportId = 0 -- put id here
local debounce = true -- to prevent players from clicking more than once.
script.Parent.MouseButton1Click:connect(function(click)
if frame and debounce then -- checks if frame exists
debounce = false -- prevents multiple clicking
frame.Visible = true
wait(10)
game:GetService('TeleportService'):Teleport(teleportId, game.Players.LocalPlayer)
end
end)
|
|
|
@Toon It Disabled my GUI button so It wont go to any other Games.
|
|
|
Idk if this will help but http://prntscr.com/a176td
|
|
Dev_RyanJoin Date: 2013-03-10 Post Count: 451 |
Oh then change:
local frame = script.Parent:WaitForChild("FRAME NAME")
to:
local frame = script.Parent.Parent.Parent:WaitForChild("OJHWarning") |
|
|
Ok, GUI Opens (Yay) and now... IT dont teleport...
|
|
|