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

How Would I Make My Script FilteringEnabled Compatible?

Asked by 6 years ago

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

Log in to vote
0
Answered by
Nowaha 459 Moderation Voter
6 years ago
0
Why did this get downvoted. Seriously? These are sources to learn how to use them. Nowaha 459 — 6y
Ad
Log in to vote
0
Answered by
lukeb50 631 Moderation Voter
6 years ago

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.

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. N30_Vehicle -2 — 6y
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 lukeb50 631 — 6y

Answer this question