What you are doing here (assuming this script is a LocalScript) is changing the GUI only for the one player that clicks it (the client). With Filtering Enabled on, the client can only make changes to their game, and not the entire server. This is good because it can stop exploits. There is a way around this for you, though. You will have to use RemoteEvents.
RemoteEvents is an event that either the client or server can trigger to communicate with each other. In your case, you want your script to tell the server to tell all the other clients to change their GUI. That is the client communicating with the server and then the server communicating back to all of the clients(players).
To start this we will create the RemoteEvent:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local changeGUI = Instance.new("RemoteEvent",ReplicatedStorage)
changeGUI.Name = "changeGUI"
Now, we want to tell the server that the client has clicked the button:
script.Parent.MouseButton1Click:Connect(function()
changeGUI:FireServer()
end)
Create a script under ServerScriptService and name it what you would like. This script will send the message to all clients to change the GUI.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local changeGUI = ReplicatedStorage:WaitForChild("changeGUI")
changeGUI.OnClientEvent:Connect(function()
changeGUI:FireAllClients()
end)
Now back to the LocalScript add this after everything else. This will run on every client's game and change the GUI for them.
changeGUI.OnServerEvent:Connect(function()
if script.Parent.Parent.Parent.Parent.CALLSIGNSHOWGUI.ScrollingFrame.TextLabel.Text == "EMPTY" then
script.Parent.Parent.Parent.Parent.CALLSIGNSHOWGUI.ScrollingFrame.TextLabel.Text = script.Parent.Parent.TextBox.Text
script.Parent.Parent.Parent.Parent.CALLSIGNSHOWGUI.Enabled = true
script.Parent.Parent.Parent.Parent.INPUTGUI.Enabled = false
end
end)
Altogether, you will have two scripts that look like this...
Server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local changeGUI = ReplicatedStorage:WaitForChild("changeGUI")
changeGUI.OnClientEvent:Connect(function()
changeGUI:FireAllClients()
end)
Local script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local changeGUI = Instance.new("RemoteEvent",ReplicatedStorage)
changeGUI.Name = "changeGUI"
script.Parent.MouseButton1Click:Connect(function()
changeGUI:FireServer()
end)
changeGUI.OnServerEvent:Connect(function()
if script.Parent.Parent.Parent.Parent.CALLSIGNSHOWGUI.ScrollingFrame.TextLabel.Text == "EMPTY" then
script.Parent.Parent.Parent.Parent.CALLSIGNSHOWGUI.ScrollingFrame.TextLabel.Text = script.Parent.Parent.TextBox.Text
script.Parent.Parent.Parent.Parent.CALLSIGNSHOWGUI.Enabled = true
script.Parent.Parent.Parent.Parent.INPUTGUI.Enabled = false
end
end)
Comment if you have any questions.
Hope this helped, good luck!
3 comments
Im assuming this is a local script, and that this is changing the player GUI. Player GUI will change it only for the client. Edit: sorry misread it, what turtle said.
It's to do with server-client communication (FE/Filtering Enabled). You would have to iterate through all the players guis OR use an event.
What turtle said. Maybe you could fire all clients with a remote event.