Okay, I am working on a little project so I can learn more about lua, I have no hopes into turning this project into a game but what I am working on is a case system and my goal is here trying to make a random image show up in the frame where I put the images. Here is my code:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Parent.YouGot.BigFrame.Visible = true
script.Parent.Parent.Parent.Parent.YouGot.BigFrame.Result:GetChildren().Visible = false
end)
while true do
result = math.random(1,5)
if result == 1 then
game.StarterGui.YouGot.BigFrame.Result.BrilliantBombtastic.Visible = true
end
if result == 2 then
game.StarterGui.YouGot.BigFrame.Result.Prankster.Visible = true
end
if result == 3 then
game.StarterGui.YouGot.BigFrame.Result.GravityCoil.Visible = true
end
if result == 4 then
game.StarterGui.YouGot.BigFrame.Result.GreenShutterShades.Visible = true
end
if result == 5 then
game.StarterGui.YouGot.BigFrame.Result.NinjaMaskOfLight.Visible = true
end
end
When I run the game everything works fine but the error I get right off the bat is that none of the images are valid members of Frame. The "Frame" the output is directing to is the "Result" which is the frame where all the images are(this is only a guess, I could be wrong but this guess makes sense since all my frames have different names). Any help is appreciated! Thanks guys. EDIT: I am using a Local Script.

3 comments
Okay, thanks for the help! Unfortunately, when I run this script, I get an error saying: 22:26:06.910 - Players.BigChildren.PlayerGui.Cases.Frame.Common.LocalScript:26: attempt to index local 'result' (a number value). I have gotten this error for lines 26 and 23. I have tested the script only twice so I think it would say this for all the other lines that have to do with making a image visible.
can you provide a picture of how it looks like in your explorer, would make this easier
do you have a discord I could send this to?