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

I am getting a "Infinite Yield" on AirDropNoticeGui, Can you show me what I am doing wrong?

Asked by
DBoi941 57
5 years ago

I am getting a "Infinite yield" error on AirDropNoticeGui I do not understand why I can see it in PlayerGui. I have also tried it this way: Nam.PlayerGui.AirDropNoticeGui.Main.Visible = true Then I get an error saying it don't exist.

local plr = game:GetService("Players")

for p, Nam in pairs(plr:GetChildren()) do

    Nam.PlayerGui:WaitForChild("AirDropNoticeGui").Main.Visible = true
        print("1st")
        wait(5)
    Nam.PlayerGui:WaitForChild("AirDropNoticeGui").Main.Visible = false
        print("2nd")

    break
end
    wait(15,50)
end
0
Then it doesn't exist. The error answers your question. DeceptiveCaster 3761 — 5y
0
Also I am trying to get a GUI to show for all players. The Gui called "AirDropNoticeGui" is in StarterGui so all player do spawn with it. DBoi941 57 — 5y
0
I understand it does not see it but As I run the game I can see it in the playergui. I even copy and pasted the name to make sure it was right. DBoi941 57 — 5y
0
I didn't know you could use starter gui like that. I will give that a try thank you. DBoi941 57 — 5y
View all comments (6 more)
0
Ok I tried to do in StarterGui and that does work in StarterGui does no show on client side. SO it has to change it in PlayerGui I still do not understand Why it is not finding it when I can see it there. DBoi941 57 — 5y
0
An Infinite yield means that the child being called is taking too long to be called. Try adding a wait() function instead of waitforchild() and make sure that the spelling is correct. Dev_Coda 31 — 5y
0
Are you doing this in a server (normal) script? Server scripts can’t access PlayerGui, only local scripts can. User#20279 0 — 5y
0
Yes I am using a Script not a LocalScript. DBoi941 57 — 5y
0
What I am trying to do is a model is being placed it the workspace that works fine, Then I am trying to notify all players with a Gui. DBoi941 57 — 5y
0
^ Do all this in a local script then. Check if the model is placed then show the GUI through “game.Players.LocalPlayer.PlayerGui” and etc. User#20279 0 — 5y

1 answer

Log in to vote
1
Answered by
IDKBlox 349 Moderation Voter
5 years ago

I see your issue here..

so what you're wanting is this

Server Script-- ``` local notifyEvent = Instance.new('RemoteEvent',game.ReplicatedStorage) notifyEvent.Name = 'notifyEvent

while wait(15,50) do notifyEvent:FireAllClients() end ```

Local Script -- ``` local Player = game:GetService('Players').LocalPlayer local PlayerGui = Player:WaitForChild('PlayerGui') local Adng = PlayerGui:WaitForChild('AirDropNoticeGui') local notifyEvent = game:GetService('ReplicatedStorage'):WaitForChild('notifyEvent')

notifyEvent.OnClientEvent:Connect(function() Adng.Main.Visible = true wait(5) Adng.Main.Visible = false end) ``` If you have any question Please feel free to ask!

0
What this does is it creates a RemoteEvent which gets fired every 15 to 50 seconds to every client in the game; telling each client to make that gui visible and then after 5 seconds makes that gui not visible again. IDKBlox 349 — 5y
0
Thank you very much now I can see what I have done wrong. DBoi941 57 — 5y
0
You are very welcome! Yeah, You're wanting PlayerGui not StarterGui ;P Anything within StarterGui gets replicated to every players PlayerGui when they join the game! IDKBlox 349 — 5y
Ad

Answer this question