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

GUI not turning invisible or visible?

Asked by
novipak 70
9 years ago

Okay, so what I am trying to do in my game is make a GUI turn invisible if a variable called inCutscene = true, and turn back visible if it is false. I currently have an intro GUI working which sets the inCutscene variable to true and false at the appropriate time, except it won't turn the other GUI, called updateButton, true or false. Here is a screenshot of my current setup:

http://gyazo.com/ec8de49ad48c64efbdf34438a3305bf1

Now I will show you the code for the intro GUI which should turn inCutscene to true/false:


updateInfo = script.Parent.updateInfo Intro = script.Parent SS = game.ServerStorage Player = script.Parent.Parent.Parent.Parent.Parent cutscene = game.StarterGui.UIconfig.inCutscene if SS:FindFirstChild(Player.Name) then script.Parent.Parent.Visible = false script:Destroy() else cutscene.Value = true Intro.Visible = true updateInfo.Visible = false for i=1, 10 do wait(0.1) Intro.TextTransparency = Intro.TextTransparency - 0.1 end wait(5) for i=1, 10 do wait(0.1) Intro.TextTransparency = Intro.TextTransparency + 0.1 end Intro.Text = "Volea" for i=1, 10 do wait(0.1) Intro.TextTransparency = Intro.TextTransparency - 0.1 end updateInfo.Visible = true for i=1, 10 do wait(0.1) updateInfo.TextTransparency = updateInfo.TextTransparency - 0.1 end wait(5) for i=1, 10 do wait(0.1) updateInfo.TextTransparency = updateInfo.TextTransparency + 0.1 end for i=1, 10 do wait(0.1) Intro.TextTransparency = Intro.TextTransparency + 0.1 end updateInfo.Visible = false Intro.Visible = false for i=1, 10 do wait(0.01) Intro.BackgroundTransparency = Intro.BackgroundTransparency +0.1 end for i=1, 10 do wait(0.1) Intro.Parent.BackgroundTransparency = Intro.Parent.BackgroundTransparency +0.1 end cutscene.Value = false script.Parent.Parent.Visible = false A = Instance.new("BoolValue",SS) A.Name = Player.Name end

Now here is the code of the GUI which I want to turn visible when inCutscene = false and invisible if inCutscene = true:

button = script.Parent
inCutscene=game.StarterGui.UIconfig.inCutscene
--Check if we're in a cutscene
if inCutscene.Value == true then
    button.Visible = false
    button.Active = false
    button.Parent.Visible = false 
    button.Parent.Active = false
else
    button.Visible = true
    button.Active = true
    button.Parent.Visible = true
    button.Parent.Active = true
end
--Debounce
local Debounce = false


script.Parent.MouseButton1Click:connect(function(Clicked)
    if Debounce == false and inCutscene.Value == false then
        Debounce = true
        print("Button clicked.")
        wait(1)
        Debounce = false    
    end
end)

Thank you for reading! I hope we can find an answer :)

0
Update: I attempted to put the script which will change the boolValue into the boolValue itself. The button now cannot be clicked during cutscenes but is still visible. novipak 70 — 9y

Answer this question