Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Infinite Yield on WaitForChild even though the child is right there?

Hello, I have been recently trying to code a script that simply removes I gui that a :insert script creates abruptly in my game. I cannot understand this issue clearly.

My code:

local players = game:GetService("Players")
player = players.LocalPlayer


players.PlayerAdded:Connect(function(player)
	wait(1)
	if player ~= nil then
	local a = player:FindFirstChild("PlayerGui")
	local b = a:WaitForChild("MuteButtonGui") -- Infinite yield, look at screenshot though!
	b.Enabled = false
	end
end)

https://imgur.com/a/yuBcjLn

This is most likely I simply issue I cannot wrap my head around haha!

4 comments

0

Check if there is a space behind MuteButtonGui name example "MuteButtonGui "

0

Sadly not

0

Is this done in a LocalScript or ServerScript?

0

Is this a local script?

1 answer

✓ Accepted answer

It's not possible to view other player's PlayerGui's as a client or server. This can only be seen by the player itself.

This discussion is preserved as it was. New answers, comments, and votes are closed.