I put a text label's text through as an argument for FireAllClient, and on the server, it prints it but not on the client. I'm making a GUI and when a text changes, I need it to show up on a TextLabel to all players.

NORMAL SCRIPT VVVVVVVVVVVV

local RepStorage = game:GetService('ReplicatedStorage')
local GlobalEvents = RepStorage:WaitForChild("GlobalEvents")
local StatValue = RepStorage:WaitForChild("StatusValue")
local TxtValueChange = GlobalEvents:WaitForChild("TxtValueChange")

script.Parent.Text = StatValue.Value
StatValue.Changed:connect(function()
	
	TxtValueChange:FireAllClients(script.Parent.Text)
	
end)

LOCAL SCRIPT VVVVVVVVVVV

local RepStorage = game:GetService('ReplicatedStorage')
local GlobalEvents = RepStorage:WaitForChild('GlobalEvents')
local TxtValueChange = GlobalEvents:WaitForChild('TxtValueChange')
local StatusValue = RepStorage:WaitForChild('StatusValue')

TxtValueChange.OnClientEvent:connect(function(text)
	
	print(text) --prints nil on clients and prints the text on server
	
	text = StatusValue.Value
	
end)

4 comments

0

You don't print anything on the server in these scripts, so I'm confused.

0

You don't have a script in StarterGui or something do you? Where are these scripts located? :P

0

The error that I get in the output of the player is that the arguments in the localscript that are in the client event are nil. The server output when I run a test server, it prints the text argument that's in the OnClientEvent just fine.

0

The server script is located in ServerScriptService and the LocalScript is in ReplicatedFirst.