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

Frame does not exist? GUI help.

Asked by
bloxxyz 274 Moderation Voter
9 years ago

Basically, I have a ClickDetector in a Part, and when you click on it a GUI appears. After 3 seconds, the Frame's background is supposed to fade out, but Studio is trying to tell me a Frame doesn't exist, but it clearly does as a Child of the GUI. Here's my script, am I missing something? Because I have no idea. Everything works up to line 9.

This is the error I get: Frame is not a valid member of ScreenGui. Thank you if you can help.

local blurdialogue = game.Lighting.WindowBlurGUI1
script.Parent.ClickDetector.MouseClick:connect(function(plr)
    print("This window is too blurry to be seen through")
    local blurclone = blurdialogue:Clone()
    blurclone.Parent = plr.PlayerGui
    wait(3) 
    for i = 0, 1, .5 do
        blurclone.Frame.Transparency = i
        wait()
        blurclone:Destroy()
    end 
end)

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

You include in your loop that you want to get rid of burclone. This will remove all of its children, causing the error.

The solution is to :Destroy() the gui after the loop, not in the middle of fading it out.

0
Oh wow, didn't even think of that. Works perfectly, thank you so much! bloxxyz 274 — 9y
Ad

Answer this question