evocul
(evocul)
February 17, 2021, 12:16am
#1
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
M9_Sigma
(Final_Sigma)
February 17, 2021, 12:19am
#2
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.
evocul
(evocul)
February 17, 2021, 12:23am
#3
Loop contains some BoolValue changing, teleportation of specific players to specific points and some arithmetics.
And gotchu I’ll change that
M9_Sigma
(Final_Sigma)
February 17, 2021, 12:23am
#4
I meant which script has the while true loop? Client or Server? Both?
evocul
(evocul)
February 17, 2021, 12:24am
#5
Server has the loop within it, the event firing is within the loop (but will only trigger once)
M9_Sigma
(Final_Sigma)
February 17, 2021, 12:25am
#6
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?
evocul
(evocul)
February 17, 2021, 12:27am
#7
Yep they’re all enabled. And zero errors, I’ve checked a load of times but have found nothing
M9_Sigma
(Final_Sigma)
February 17, 2021, 12:27am
#8
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.
kylerzong
(kylerzong)
February 17, 2021, 12:29am
#9
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)
M9_Sigma
(Final_Sigma)
February 17, 2021, 12:32am
#10
Do not use Instance.new("Object", Parent)
It can cause performance issues, you should be setting the Parent property last.
2 Likes
kylerzong
(kylerzong)
February 17, 2021, 12:32am
#11
Prove it
I do not believe it causes performance issues
M9_Sigma
(Final_Sigma)
February 17, 2021, 12:34am
#14
Is it printing on the client as well? That is what I’m more interested in.
evocul
(evocul)
February 17, 2021, 12:35am
#15
Nope that’s all from the server, when the client is fired it should print, the print isn’t there
M9_Sigma
(Final_Sigma)
February 17, 2021, 12:36am
#16
print("Testing if it reaches this point")
Events.MatchInfo.OnClientEvent:Connect(function()
print("TESTING MATCH INFO")
end)
Please test and see if that prints
SOTR654
(SOTR654)
February 17, 2021, 12:37am
#17
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.
M9_Sigma
(Final_Sigma)
February 17, 2021, 12:38am
#18
Considering this is in a while true loop I don’t think this is the problem unfortunately. Since it will be repeatedly firing.
kylerzong
(kylerzong)
February 17, 2021, 12:39am
#19
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