So PlayerGui is basically StarterGui, but ONLY for the player. StaterGui is a sever-wide GUI. A LocalScript is only for the client also, so it will only really change the GUI for the client running the code. IF you are making a shop open and close, you should change that in the PlayerGui though, to cause less problems that could occur.
why would roblox create a whole new thing (playergui) for altering client gui and not just let the client locally change startergui
Because PlayerGui is only changeable to the Player which the PlayerGui is parented to. If you changed something in StarterGui, it could show it on another clients screen instead of the player using the script or button.
Also, I’m at school, so sorry for late responses.
youre good lol
thanks for the help, ill go use it now
Yep, also if I did help you fix this, mark me as solution, so people are aware this is solved!
Stater GUI, like starter character, stater player, and backpack, are all instantiating folders.
Whatever is in these folders when a Player is added or their character is loaded copies from these folders into their respective places
Stater Gui into Player gui
Backpack into Backpack
Stater character into character
Etc
A server editing the objects within Starter GUI will show, but only when you Reload the player’s character.
Unless something has changed in the last 5 years, Roblox has always worked this way.
Yes, but they were asking how PlayerGui works.
oh shoot
well im trying to have it constantly update server-wide without players being reset, how would i accomplish that?
That’s fair, the way you phrased your responses seemed like you could edit everyone’s active Guis from the server, which you cannot.
ok well in that case how am i supposed to have everyones ui be the same serverwide
If you have a victory screen, for example. Just FireAllClients via remote Event and let the local script display the victory screen.
Or if it is a leaderboard or something else with data, pass the data though to the client and let the local script render it.
i figured id have to do remote events uggggggggggh
just before i try anything and mess it up (im stupid) could i have a remote event fire that just changes text and have the text be the parameter
is that the simplest way for me to do this
just one remote event
(my goal is to change gui text for everyone)
i guess thered be a timer too but you know
If it is only a string you’re passing, do what @kilesix suggested with the Number Value, but instead use a StringValue.
But if you want to expand your knowledge and scale your code with more data, Remotes are the way to go.
wouldnt remote events just remove the middle man tho
oh but then again if someone joined the game late then the text wouldnt appear for them
so how do i do this, just have the server script change the string value and have the local scripts constantly changing the text label to the text of the string value…?
So then you can make a new remote event for when a player joins, and if it fires, then disable the Gui.
With the RemoteEvent you would send the current state when the player joins, or when the player asks for it, do this if you’re comfortable with remotes. Otherwise I would use ValueBase | Roblox Creator Documentation in ReplicatedStorage, you can get the current state simply with just .Value, and you can listen to when the state changes with .Changed:Connect(). Same concept as what I posted earlier with the timer example.
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
v.PlayerGui.ScreenGui.Frame.TextBox.Text = i
end
( you can modify playergui on the server )
As stated before by me, change the Gui itself from a NORMAL script, under ServerScriptService. Changing the text would be easy, add this into the Script in ServerScriptService:
local TimerValue = 100
----------------------
local TimerGui = Instance.new("ScreenGui", game.StarterGui)
TimerGui.Name = "TimerGui"
--------------------------
local TimerText = Instance.new("TextBox", TimerGui)
TimerText.Text = tostring(TimerValue)
----------------
while wait(1) do
TimerText.Text = tostring(TimerValue - 1)
if TimerText.Text == 0 then
break
end
This should work, let me know if not.
StarterGui would require all players to restart to see the GUI instead,
for i,v ipairs(game.Players:GetPlayers()) do
--clone text to playergui whatever
-- also, playergui is v.PlayerGui
end
It would change for all players.