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

I can't seem to figure out why my math.random script is not working?

Asked by 4 years ago
local module = require(script.Parent:WaitForChild("ModuleScript"))
local gui = game.StarterGui.ScreenGui.Clicks10


script.Parent.Activated:Connect(function()

    module.click1()

    script.Parent.Visible = false

local x = math.random(10)

if x == 1 then gui.a1.Visible = true else
    if x == 2 then gui.a2.Visible = true else
        if x == 3 then gui.a3.Visible = true else
            if x == 4 then gui.a4.Visible = true else
                if x == 5 then gui.a5.Visible = true else
                    if x == 6 then gui.a6.Visible = true else
                        if x == 7 then gui.a7.Visible = true else
                            if x == 8 then gui.a8.Visible = true else
                                if x == 9 then gui.a9.Visible = true else
                                    if x == 10 then gui.a10.Visible = true
end
end
end
end
end
end 
end 
end 
end
end 
end
end)

I'm trying to make one gui appear after clicking another, but I can't seem to make another one appear. the first one just disappears and a second one does not become visible. Any ideas?

1
If you want to change the look of a gui in the middle of the game, use PlayerGui not StarterGui Sulu710 142 — 4y
1
I think you would have to use local x = math.random(0,10) --minimum value is 0 and max is 10. SitaruDaniel 44 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

"I think you would have to use local x = math.random(0,10) --minimum value is 0 and max is 10."

SitaruDaniel is correct here.

Ad

Answer this question