Remote Event Not Firing

I explained and wrote the script as an example, not for use, but to understand the meaning.

1 Like

So to let a player load in, should I simply just add a delay?

local status = game.ReplicatedStorage.Variables.Status

-- remotes for schedule (sloppy)

local folder = game.ReplicatedStorage.Remotes.ScheduleRemotes
local events = {folder.StatusChangeStaff,folder.StatusChangeStaff2,folder.StatusChangeStaff3,folder.StatusChangeStaff4}

local status = 1

while task.wait(120) do
       if status >= #events then status = 1 else status += 1 end
       if (events[status]) then
           events[status]:FireAllClients()
       end
end

This script basically loops every 120 seconds (doesnt matter if player is in or not)
if the player is in during the wait time (120 seconds) then they have to wait then they will get the next notification.

(Just like jailbreak or prison life they dont wait for you to join, their script work according to server so if its almost sleep time and player joined the game then they have to wait for the notification when its their sleep time)

1 Like

I think you should watch the video that l_oL’s recommended.

You’re if statement has no then

Oh I lol I did a typo.
I thought I am writing in javascript, I’ll correct it real quick.

I don’t want it to run off the clock time though

I played around with it a bit and got something like this.

Server:

local t = {[1] = "Breakfast"; [2] = "Dinner"; [3] = "Sleeping time"}
local n = 0

local remote = -- your RemoteEvent.

while wait(math.random(3,5)) do
	if n >= #t then n = 0 end	
	n = n + 1
	
	remote:FireAllClients(t[n])
end

Client:

local remote = -- your RemoteEvent.

remote.OnClientEvent:Connect(function(status)
	print(status)
end)
1 Like

I fixed everything by adding a 2 second delay, allowing for the player to load in, thank you for the help