How do you Change a GUI With a Server Script (Normal Script)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a normal script that changes a GUI. Ex: Makes a GUI visible
  2. What is the issue? Include screenshots / videos if possible!
    I can’t seem to find a good solid answer anywhere.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked at a lot of places. I know it should be easy to find but most people are just saying like you should use a local script or whatever. I can’t find a good answer.
1 Like

What is this gui used for? e.g countdown

1 Like

Do you need it to update on all clients? If so, this article will be helpful for you. Developer Hub

1 Like

Don’t ever modify UI from the server, like ever. All UI should be handled from the client.

All you have to do is access the PlayerGui from a LocalScript, it’s very straight forward.

Do proper research, changing the visible property of a GUI is a VERY simple thing to do.

2 Likes

YEah, please do some research. GUIs cannot be set locally.

2 Likes

Fire a RemoteEvent that the client(s) are listening to, and then on the client, perform the action you want e.g.

-- server
local remote = --some remote
remote:FireClient(player) -- or remote:FireAllClients()

-- client
local remote = -- some remote
local guiobject = -- some gui obj
remote.OnClientEvent:connect(function ()
guiobject.Visible = true
end)
2 Likes

You could do something like this:

game.PlayerAdded:Connect:(function(player)


--when something happens such as:
game.ServerStorage.Property.Changed:Connect(function() 

player.PlayerGui.GUI.Enabled = false


end) 

end) 


Replace Property and GUI with something else.

5 Likes

I just want to update it for the local player

1 Like

An in-game tablet. I know that I could use a local script for some of it but I just want it to all be server-sided.

1 Like

Thank you very much! I think this is just what I want :smiley:

1 Like

A certain player or all players

1 Like

Late response? Maybe, but I have used this in a lot of old projects of mine like 3 years ago, works perfectly fine, u dont have to worry abt yielding and stuff

2 Likes

Changing UI from server is totally fine. I’ve been doing it for all my games since I originally posted this. No issues. Only thing is, if you make a ui element on a local script for example. the server won’t be aware of it and it will error. of if u make something invisible on a local script, the server will still think it’s visible

User interfaces (UI) is and always will be client-sided. The client renders it and interacts with it. The replication boundary will ultimately prevent you from being able to solely develop UI from the server, as more adverse consequences involve user input not replicating. The next major issue is latency. UI is the last thing the user should be experiencing latency in. and this is one part of why user experience (UX) is so closely associated with UI.

The most harmful ideology in software development is “if it works, it works”. It is a key path to inviting the consequences of Murphy’s laws

when I meant by ‘for me its working’, doesn’t mean i meant that i have been using it on buttons, for that i have a custom handler but i use it mainly for protection against skids / cheaters, stealing code and using it as obfuscated has been a common problem, for visuals its the best thing to use if u want your code protected, about latency, it may have a small delay but I really much doubt it’ll have a lot of impact, on <13 kids won’t care abt the small delay produced unless its 1+ second OR a noticeable delay

btw, I have never used serverside for UI creation or rendering, UNLESS its a engine which i have tried and completed a lot. I exprimated myself wrong when i said its totally fine to use it

Of course UI is made to be MOSTLY client based, but that DOESN’T MEAN it should all be. There are many times where it should be server based. for example a match countdown timer should be changed from server so it’s in sync with all players. Also buying items should be controlled on server. It’s too easy to exploit if not in many cases. If a player buys a item the server should take the money from the player and only then add it to their inventory to be able to be used

None of these examples requires you to operate UI from the server. UI should continue to be operated on the client, where RemoteFunctions and/or RemoteEvents are used to involve the server

but it’s easier to do certain things from the server and i see absolutely no downside and plenty of upsides so i’m going to keep doing it