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

Next Button In My GUI Doesn't Work and It Doesn't Give any Errors?

Asked by 7 years ago
Edited 7 years ago

I've made pages in my GUI but my next page button isn't working. I tried a lot of thing but none of them worked. Please help.

Click this if you would like to see the GUI.

This is the highlighted script in the next button:

local Frame = script.Parent.Parent.Parent:WaitForChild('MainFrame')
local Page1 = Frame.Page1
local Page2 = Frame.Page2
local Page3 = Frame.Page3


script.Parent.MouseButton1Click:connect(function()

Page1.Visible = false
wait(0.1)
Page2.Visible = true

end)
1
Try prining something in the function. FiredDusk 1466 — 7y
0
I already tried it and printing works in the function. araltan2002 47 — 7y

2 answers

Log in to vote
1
Answered by
Wiscript 622 Moderation Voter
7 years ago
Edited 7 years ago

Not sure why your script doesn't work. Here's what I tried though

local Frame = script.Parent.Parent -- Accessing MainFrame
local Page1 = Frame:WaitForChild("Page1")
local Page2 = Frame:WaitForChild("Page2")
local Page3 = Frame:WaitForChild("Page3") -- Unecessary if not being used


script.Parent.MouseButton1Click:connect(function()

Page1.Visible = false
wait(0.1) -- Remove as it's not necessary (unless you really want that delay to happen)
Page2.Visible = true

end)
Ad
Log in to vote
-1
Answered by 7 years ago

I fixed the problem by adding an If Statement

local Frame = script.Parent.Parent.Parent:WaitForChild('MainFrame')
local Page1 = Frame.Page1
local Page2 = Frame.Page2
local Page3 = Frame.Page3


script.Parent.MouseButton1Click:connect(function()

if Page1.Visible == true
    then
    Page1.Visible = false
    wait(0.1)
    Page2.Visible = true
    else
    print("Problem")
end

end)

Answer this question