CERTAIN LOCALSCRIPTS NOT WORKING - Events not firing?

Hey, event isn’t firing, no clue why and I feel like ripping my hair out (again).

This is all within a while true loop, where multiple things should happen (only once), won’t post that code here though, it works perfectly, and the code below the event firing continues to work too.

Client script is located in a GUI
Server in SSS
Event in repS>events

– Server

game.ReplicatedStorage.Events.MatchInfo:FireAllClients()

– Client

game.ReplicatedStorage.Events.MatchInfo.OnClientEvent:Connect(function()

print(“TETSING MATCH INFO”)

end)

EDIT:
After tests certain LocalScripts fail to work.
A simple “print(“hello”)” did not print
(more info located lower than the replies)

1 Like

What is in the while true loop? Can you be more specific?

Also you should use:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage.Events

Better practice.

Loop contains some BoolValue changing, teleportation of specific players to specific points and some arithmetics.

And gotchu I’ll change that

I meant which script has the while true loop? Client or Server? Both?

Server has the loop within it, the event firing is within the loop (but will only trigger once)

This might seem silly but have you ensured both scripts are enabled? As well as that your client script is actually running? The problem might actually be on your client/server script that is preventing the code from executing far enough to reach the Event code.

Have you checked output for any errors?

Yep they’re all enabled. And zero errors, I’ve checked a load of times but have found nothing

Can you put a print statement before the declaration of the Event listener and the Event firing statement? See if those are outputting to console.

Server

local MatchInfo = Instance.new("RemoteEvent", game.ReplicatedStorage)
MatchInfo.Name = "MatchInfo"
while wait(2) do
	MatchInfo:FireAllClients()
end

Local

local MatchInfo = game.ReplicatedStorage:WaitForChild("MatchInfo")
MatchInfo.OnClientEvent:Connect(function()
	print("Client Event")
end)

Do not use Instance.new("Object", Parent)
It can cause performance issues, you should be setting the Parent property last.

2 Likes

Prove it
I do not believe it causes performance issues

1 Like

Here they are; image

Is it printing on the client as well? That is what I’m more interested in.

Nope that’s all from the server, when the client is fired it should print, the print isn’t there

print("Testing if it reaches this point")
Events.MatchInfo.OnClientEvent:Connect(function()
     print("TESTING MATCH INFO")
end)

Please test and see if that prints

Does this start at the beginning of the code?

Some time ago I had a problem like this and that was why. I solved it by placing a wait () at the beginning of the localscript.

Considering this is in a while true loop I don’t think this is the problem unfortunately. Since it will be repeatedly firing.

I see, its only happening once at the start of the script so I choose less lines rather than performance… I will keep the post you linked in mind when instantiating lots of instances in a small amount of time

Nothing;

(no errors etc)