I have a bit of really simple code that should disable a gui for some players, but for some reason nothing happens. I added print statement and it prints “running” and the players names so I have no idea why this isn’t working. (This is in a server script)
for i = #gamePlayers, 1, -1 do
print("running")
print(gamePlayers[i].Name)
gamePlayers[i].PlayerGui.MatchResult.Enabled = false
end
Are you trying to make them unable to use the GUI, or hide it from view? Because if you’re trying to hide it from view then you would use .Visible, which also disables any events from being fired through mouse clicks on the UI (I could be more thorough but I’m running on 0 hours of sleep and am not home atm… idk why I’m on rn LOL)
It’s been a while since I’ve worked with screen gui since I just set the visibility of a frame or something to false instead, but I think I had the same issues when I did. Have you tried doing it locally? Like sending an event to a local script (Or making the script function out of a local script)
Edit: Just a suggestion. For me it feels kinda random when it decides to work for each, I have a mix of local scripts and a server script to do the UI stuff for my game which was mostly through trial and error
Also I’m home now so I’ll see whether your script works or not for me and if not I’ll see how I can fix it
Thank you very much, yeah i find the same thing, editing guis on the server works sometimes and sometimes not, I don’t know why it only works sometimes but I think its better practice to do it on the client anyway so ill do that in the future. I just switched to use remote events and its all working fine. Thank you very much for your help
I tested as both server and local script and both work. But taking into account you have the script inside the screengui, it should definitely be local anyway, that way it’s not a bunch of server scripts being duplicated amongst every player