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

Can someone help troubleshoot this?

Asked by 10 years ago

So here is the script:

function move()
    for k,p in pairs(game.Players:GetChildren()) do
        gui=p.PlayerGui:FindFirstChild("Notifications")
        print("Found gui")
        gui:WaitForChild("Frame")
        gui.Frame.Visible=true
        print("Visible")
        for i=1,30 do
            gui.Frame.Position=gui.Frame.Position+UDim2.new(0,0,.05,0)
            wait(.01)
        end
        print("Moved")
    end
end

It works once, but then if I try again, output tells me

Frame is not a valid member of ScreenGui

Script 'Workspace.Script', line 36 - global move

script 'Workspace.Script', Line 84

Stack End

The Line 84 is this: (I used -- to tell the line number in the actual script)

for k,plr in pairs(game.Players:GetPlayers()) do--81
            plr.PlayerGui.Notifications.Frame.TextLabel.Text="SFT2 has been loaded. Please wait for further instruction"--82
            plr.PlayerGui.Notifications.Frame.Visible=true--83
            move()--84
            wait(3)--85
            plr.PlayerGui.Notifications:Destroy()--86
            end --87        

GUI Function:

function GUI()
    for k,plr in pairs(game.Players:GetPlayers()) do
        model=game.ServerStorage:FindFirstChild("Notifications")
        guiclone=model:Clone()
        guiclone.Parent=plr.PlayerGui
    end
end

0
Line 86 Destroys the GUI, do they eventually respawn or something so they'd get it back? Shawnyg 4330 — 10y
0
Yes there is a function named GUI() which clones it from serverstorage Tempestatem 884 — 10y
0
Could you possibly give the order in which everything is called. The Move function, the GUI function, and when line 84 commences. Shawnyg 4330 — 10y
0
It first does GUI(), then what I just posted above Tempestatem 884 — 10y
View all comments (2 more)
0
Could you add your GUI function in there? Shawnyg 4330 — 10y
0
Ok added it Tempestatem 884 — 10y

Answer this question