Issue with :fireallclients()

Trying to make an objective system however whenever I want to fire the event to change the text, there’s no errors but whenever I get to the firing part it doesn’t do anything.

Obj1 = ObjectiveSystem.Create("Make the call for help!")

Remotes.Objectives:FireAllClients(Obj1.ObjectiveName)
Local
local Objectives = game.Workspace.GameObjects.Objectives
local remote = game.ReplicatedStorage.Remotes:WaitForChild("Objectives")
task.wait(1)
remote.OnClientEvent:Connect(function(ObjectiveName)
	print(ObjectiveName)
	script.Parent.ObjectiveFrame.Objective.Text = "Complete"..ObjectiveName
end)
1 Like

It should be FireAllClients() instead of FireAllClients

1 Like

local Objectives = game.Workspace.GameObjects.Objectives
local remote = game.ReplicatedStorage.Remotes:WaitForChild("OnClientObjectiveEvent")


remote.OnClientEvent:Connect(function(ObjectiveName)
    print(ObjectiveName)
    Objectives.ObjectiveFrame.Objective.Text = "Complete " .. ObjectiveName
end)


local Obj1 = "Make the call for help!"
remote:FireAllClients(Obj1)
1 Like

thats what i did, theres no difference between my code and yours besides the obj.name

1 Like

The task.wait is suspicious to me, if your .OnClinetEvent isn’t connected on time it won’t recieve events. Does your remote fire near the start of the game?

1 Like

its the first event of the game as they load in yes

1 Like

Then you certainly need to remove the task.wait(1). If possible remove the :WaitForChild for :FindFirstChild, any remote event that should be instantly listening must have no yeilding functions before it’s connection.

1 Like

It takes quite a while for local scripts to initialize before server scripts, by average, after two or three seconds after loading in they’ll be initialized right after.

1 Like

Even when true the local scripts can accept any events fired from a OnPlayerAdded connection. So long as local script do not have yielding functions like ask.wait or :WaitForChild before connection.

1 Like

I noticed that it’d be better to move the task.wait() from the local script to the server script.

1 Like

still having the same issues while following your steps, remove all waits as well

1 Like

just fixed it myself, thanks for the help though.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.