Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FireAllClients arguments are nil? [Answered]

Asked by 6 years ago
Edited 6 years ago

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)
0
You don't print anything on the server in these scripts, so I'm confused. CootKitty 311 — 6y
0
You don't have a script in StarterGui or something do you? Where are these scripts located? :P CootKitty 311 — 6y
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. BennyBoiOriginal 293 — 6y
0
The server script is located in ServerScriptService and the LocalScript is in ReplicatedFirst. BennyBoiOriginal 293 — 6y

Answer this question