I am trying to make a GUI server-sided, I don’t know how to go about it, I would like someone to give me some knowledge, please and thank you.
Basically so everyone can see the same GUI at the same time.
I am trying to make a GUI server-sided, I don’t know how to go about it, I would like someone to give me some knowledge, please and thank you.
Basically so everyone can see the same GUI at the same time.
Yes, but say I wanted to change it live in front of them, how would I go about it?
That’s pretty easy, I will use a touched event for an example.
--normal script
local ScreenGui = script.Parent --[[ the screenGui is the parent of the script.
I am assuming you are going to have a textlabel as the child also.]]
local db = false
game.Workspace.Touched:Connect(function() -- when a player touches it, the gui will enable for everyone.
if not db then
db = true
ScreenGui.Enabled = true
wait(3)
ScreenGui.Enabled = false
db = false
end)
that’s how to make a server sided gui.
Correct me if I’m wrong, but in StarterGui, you can only use local scripts?
Server Sided GUI (if its under StarterGui/PlayerGui) is not possible.
The way you would make GUI sync to all users is by using remote events.
For example…
--//Server
local RemoteEvent = ...
local function UpdateTextLabel(NewText)
RemoteEvent:FireAllClients(NewText)
end
UpdateTextLabel("Game starting!")
--//Client (Local Script)
local RemoteEvent = ...
local TextLabel = ...
RemoteEvent.OnClientEvent:Connect(function(NewText)
TextLabe.Text = NewText
end)
RemoteEvent:FireAllClients() will fire a remote for ALL the users in game, this is very powerful when syncing data between ALL users.
This will update the TextLabel to display the new text for ALL in game players.
Ah, actually I am not really sure about that as I am a bit rusty on the gui scripting side. my apologies
Thanks; How would I go about updating it with more strings?
RemoteEvents maybe? If you mean something like that…
Sorry for late response, you can fire almost ANY values to the client. There is some circumstances when you cant, I recommend reading this article: Custom Events and Callbacks | Documentation - Roblox Creator Hub
Where does the NewText come from in FireAllClients?