Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Changes on an GUI not appearing on other Players screen, anyone know why?

script.Parent.MouseButton1Click: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)

Basically, when someone clicks the TextButton, the text from the TextBox appears on an TextLabel, but the text doesn't appear on other players screen, which is the issue.

3 comments

0

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.

1

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.

0

What turtle said. Maybe you could fire all clients with a remote event.

1 answer

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() -- Player clicks button
	changeGUI:FireServer() -- Tells server
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() -- Server recieves the message from the client that the player clicked the button
	changeGUI:FireAllClients() -- Server then tells every player
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() -- Server recieves the message from the client that the player clicked the button
	changeGUI:FireAllClients() -- Server then tells every player
end)

Local script:

local ReplicatedStorage = game:GetService("ReplicatedStorage") 
local changeGUI = Instance.new("RemoteEvent",ReplicatedStorage)
changeGUI.Name = "changeGUI"

script.Parent.MouseButton1Click:Connect(function() -- Player clicks button
	changeGUI:FireServer() -- Tells server
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!

This discussion is preserved as it was. New answers, comments, and votes are closed.