I've made a function where it sets the enabled property of all screen GUIs to true or false but only if the name of the screen GUI is not equal to the given string. I can't seem to get it to work, it sure did set the enabled property of all screen GUIs to what I have given but it doesn't check if the name of the screen GUI is not equal to the given string. Here's the function that I've made. It runs whenever the player pressed E
function SetGuiEnabled(bool)
for i,v in pairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do
if v.Name ~= "KeybindDisplays" or v.Name ~= "DialogMenu" then
v.Enabled = bool
end
end
end
the problem is at line 3 it doesn't check if the name of all screen gui is not equal to the given string. It doesn't give me any errors tho.

1 comment
That explains why it sets all the ScreenGui enabled property to the given! Tysm for you're answer!