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

How to force a gui to come up?

Asked by 9 years ago

how to do so when i press the "Dirt" the gui will pop up

local Box = script.Parent --Fortæller hvad vi leder efter
local Grass = Box.grass
local jord = Box.dirt


Box.grass.ClickDetector.MouseClick:connect(function(player)
    jord.Decal1.Texture = "http://www.roblox.com/asset/?id=48336811"
    jord.Decal2.Texture = "http://www.roblox.com/asset/?id=48336811"
    jord.Decal3.Texture = "http://www.roblox.com/asset/?id=48336811"
    jord.Decal4.Texture = "http://www.roblox.com/asset/?id=48336811"
    wait(2)
    Box:Destroy()
    Grass:Destroy()
end)

--Helping notes

Box.dirt.ClickDetector.MouseClick:connect(function(player)
    jord.Decal1.Texture = "http://www.roblox.com/asset/?id=48336811"  --This Changes the DECAL FROM HERE
    jord.Decal2.Texture = "http://www.roblox.com/asset/?id=48336811"
    jord.Decal3.Texture = "http://www.roblox.com/asset/?id=48336811"
    jord.Decal4.Texture = "http://www.roblox.com/asset/?id=48336811"  -- Stops changeing the DECAL HERE
    wait(2) -- Time before the block disapear
    Box:Destroy() -- Destroys the block(Dirt)
    Grass:Destroy() -- Destroy the block(Grass)
end)

Gui script if it is usefull somehow...

Gui = script.Parent

WG = game.StarterGui.HealthGrass.Screen

X = Gui.Size

HP = 500

while HP > 0 do

    wait()
    HP = HP -10
    Gui.Size = UDim2.new(0,math.floor(HP),0,25)
    print(HP)

end



while HP == 0 do

    Gui.Visible = false 
    break
end

1 answer

Log in to vote
0
Answered by 9 years ago

Take out the while loop at the end of your GUI script, it's not needed, just set the visibility to false. All you need to do to make the gui show up is to declare the GUI in the script with the MouseClick connect then set the visibility to true.

local gui = game.Workspace.ect
Box.dirt.ClickDetector.MouseClick:connect(function(player)
    --Bunch of code here you already wrote
    gui.Visible = true
Ad

Answer this question