Remote Event Not Firing

Hello, I am making a simple script where a remote event fire on the server to all players to change their status in a GUI.

The problem is, my script prints the ‘1’, therefore firing the remote, but on the client side script nothing happens, as seen here:

local status = game.ReplicatedStorage.Variables.Status

-- remotes for schedule (sloppy)

local folder = game.ReplicatedStorage.Remotes.ScheduleRemotes
local staff1 = folder.StatusChangeStaff
local staff2 = folder.StatusChangeStaff2
local staff3 = folder.StatusChangeStaff3
local staff4 = folder.StatusChangeStaff4

while true do
	
	staff1:FireAllClients()
	print("1")
	wait(120)
	
	staff2:FireAllClients()
	wait(120)
	
	staff3:FireAllClients()
	wait(120)
	
	staff4:FireAllClients()
	wait(120)
	
end

Client side, in StarterPlayerScripts.

game.ReplicatedStorage.Remotes.ScheduleRemotes.StatusChangeStaff.OnClientEvent:Connect(function()
	status.Value = "Breakfast"
	print("fired")
end)

‘Fired’ does not get printed.

Anyone know what my problem is?

When on client, it’d be better to do -

local Replicated = game:GetService("ReplicatedStorage")
local Remotes = Replicated:WaitForChild("Remotes")
local ScheduleRemotes = Remotes:WaitForChild("ScheduleRemotes")
local StatusChangeStaff = ScheduleRemotes:WaitForChild("StatusChangeStaff")

local STATUS  = Replicated:WaitForChild("Variables"):WaitForChild("Status")

Other than that, I’d like to see the rest of your client side [ relevant to the code]

Thanks for that,

here is the full client script

local plr = game.Players.LocalPlayer

local players = game:GetService("Players")
local teams = game:GetService("Teams")

local Replicated = game:GetService("ReplicatedStorage")
local Remotes = Replicated:WaitForChild("Remotes")
local ScheduleRemotes = Remotes:WaitForChild("ScheduleRemotes")
local StatusChangeStaff = ScheduleRemotes:WaitForChild("StatusChangeStaff")

local status  = Replicated:WaitForChild("Variables"):WaitForChild("Status")

game.ReplicatedStorage.Remotes.ScheduleRemotes.StatusChangeStaff.OnClientEvent:Connect(function()
	status.Value = "Breakfast"
	print("fired")
end)

game.ReplicatedStorage.Remotes.ScheduleRemotes.StatusChangeStaff2.OnClientEvent:Connect(function()
	if plr.Team == teams["Test Subject"] then
		status.Value = "Free Time"
	elseif plr.Team == teams["Administrative Personnel"] or plr.Team == teams["Bureau of Intelligence"] or plr.Team == teams["Department of Research"] or plr.Team == teams["Facility Personnel"] or plr.Team == teams["Maintenance Department"] or plr.Team == teams["Office of Public Enforcement"] or plr.Team == teams["Security Corps"] then
		status.Value = "Office Hours"
	end
end)

game.ReplicatedStorage.Remotes.ScheduleRemotes.StatusChangeStaff3.OnClientEvent:Connect(function()
	status.Value = "Dinner"
end)

game.ReplicatedStorage.Remotes.ScheduleRemotes.StatusChangeStaff4.OnClientEvent:Connect(function()
	if plr.Team == teams["Test Subject"] then
		status.Value = "Cell Time"
	elseif plr.Team == teams["Administrative Personnel"] or plr.Team == teams["Bureau of Intelligence"] or plr.Team == teams["Department of Research"] or plr.Team == teams["Facility Personnel"] or plr.Team == teams["Maintenance Department"] or plr.Team == teams["Office of Public Enforcement"] or plr.Team == teams["Security Corps"] then
		status.Value = "Rest"
	end
end)

Does other remote events are getting fired?

First,
Replace this script with this:

--//Services
local players = game:GetService("Players")
local teams = game:GetService("Teams")
local Replicated = game:GetService("ReplicatedStorage")

--//Variables
local Remotes = Replicated:WaitForChild("Remotes")
local ScheduleRemotes = Remotes:WaitForChild("ScheduleRemotes")
local STATUS  = Replicated:WaitForChild("Variables"):WaitForChild("Status")
local plr = players.LocalPlayer

--//Events

ScheduleRemotes:WaitForChild("StatusChangeStaff").OnClientEvent:Connect(function()
	STATUS.Value = "Breakfast"
	print("fired")
end)

ScheduleRemotes:WaitForChild("StatusChangeStaff2").OnClientEvent:Connect(function()
	if plr.Team == teams["Test Subject"] then
		STATUS.Value = "Free Time"
	elseif plr.Team == teams["Administrative Personnel"] or plr.Team == teams["Bureau of Intelligence"] or plr.Team == teams["Department of Research"] or plr.Team == teams["Facility Personnel"] or plr.Team == teams["Maintenance Department"] or plr.Team == teams["Office of Public Enforcement"] or plr.Team == teams["Security Corps"] then
		STATUS.Value = "Office Hours"
	end
end)

ScheduleRemotes:WaitForChild("StatusChangeStaff3").OnClientEvent:Connect(function()
	STATUS.Value = "Dinner"
end)

ScheduleRemotes:WaitForChild("StatusChangeStaff4").OnClientEvent:Connect(function()
	if plr.Team == teams["Test Subject"] then
		STATUS.Value = "Cell Time"
	elseif plr.Team == teams["Administrative Personnel"] or plr.Team == teams["Bureau of Intelligence"] or plr.Team == teams["Department of Research"] or plr.Team == teams["Facility Personnel"] or plr.Team == teams["Maintenance Department"] or plr.Team == teams["Office of Public Enforcement"] or plr.Team == teams["Security Corps"] then
		STATUS.Value = "Rest"
	end
end)

Now, this is more readable and more tidy.
Now may I ask you,

  1. What type of value is STATUS? [String,Number,Bool,etc…]
  2. What about other events?

3)You shoul work with task.wait rather than with wait.

Your problem is most likely that :FireAllClients() is run before the player is added to the game.

Try this:

local status = game.ReplicatedStorage.Variables.Status
local players = game:GetService("Players")

-- remotes for schedule (sloppy)

local folder = game.ReplicatedStorage.Remotes.ScheduleRemotes
local staff1 = folder.StatusChangeStaff
local staff2 = folder.StatusChangeStaff2
local staff3 = folder.StatusChangeStaff3
local staff4 = folder.StatusChangeStaff4

players.PlayerAdded:Connect(function(player)
     while true do
	
	staff1:FireAllClients()
	print("1")
	wait(120)
	
	staff2:FireAllClients()
	wait(120)
	
	staff3:FireAllClients()
	wait(120)
	
	staff4:FireAllClients()
	wait(120)
	
end
end)
1 Like

Thats not the right way to write your code.
You are basically creating a loop every time player is getting added.

Not good for performance, since its a loop theres no need of using playerAdded.

1 Like

This worked, but I don’t want it to start again every time a player is added.

Simple change it into -

players.PlayerAdded:Connect(function(player)
   staff1:FireAllClients()
   task.wait(120)
   staff2:FireAllClients()
   task.wait(120)
   staff3:FireAllClients()
   task.wait(120)
   staff4:FireAllClients()
end)

When do you want those events to occur?

The purpose of the entire script is to manage a label that displays what the time of day is, if it is relative to when a player joins, it won’t work

1 Like

Have you tried using game.Lighting.ClockTime.Changed:Connect(function()
[This will fire when the time in your game changes]

If I understood you right

It isn’t really supposed to be a clock, just a label that displays what the player should be doing, like eating breakfast or something

.Changed only works for instances, ClockTime is a number.

Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()

would be better.

1 Like

You mean something like Adopt Me?

I’ve never played Adopt Me, so what I can relate it to is something like Prison Life or something

notify system just like in jailbreak and prison life?

1 Like

Oh my bad. Thanks for correcting me :+1:

If he means that,

It doesn’t really need to be that complex, just have two minutes of breakfast, then two minutes of the next thing, and so on