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

How Would I Make My Script FilteringEnabled Compatible?

So I've been having lots of difficulties with my script. I looked at the tutorials on how to use RemoteEvent but it just confused me as I'm a new game scripter and maker so I removed it all so I could (Hopefully) get it to work with some help. So here's the code, hopefully one of you great people can edit this to make it compatible or try and walk me through what needs to be done.

local id = 996728468

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:Connect(function(character)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
character.Humanoid.WalkSpeed = 75
player.PlayerGui:WaitForChild("NoticeGUI").Note.Visible = true
player.PlayerGui:WaitForChild("ScreenGui").Run.Visible = true
player.PlayerGui:WaitForChild("ScreenGui").Walk.Visible = true
player.PlayerGui:WaitForChild("ScreenGui").TextButton.Visible = false
    else
        --Awaiting use
end
end)
end)

For further info, the problem is when FilteringEnabled is on, the output says "Infinite yield possible on player.PlayerGui:WaitForChild("NoticeGUI")"

Thanks for your time.

2 answers

This should be a server script.

The server CANNOT see GUI's inside of players, as they are on the client. This means that your :WaitForChild()'s will never find anything as they cannot see them.

2 comments

0

It seems to work with FilteringEnabled off which is what I don't get. Do you have any idea How I could fix this so that only people who own the gamepass can see the GUI? I'm still puzzled at the moment.

0

Use a remote event to tell the client to show it. Or to be safer, store the gui in serverstorage and pass a clone of it via remoteevent and a localscript parents it to the location

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