OnServerEvent not connecting

Hello,

Randomly, my code decided to stop listening to OnServerEvent.
image

game.ReplicatedStorage.PSRemotes.ServerCompleted.OnServerEvent:Connect(function(PlayerLoaded, Time, ItemClass, ItemName, ModOrRegular, item)
	print("test")

Not sure what’s going on. The event is made before the function is called:

local SpecialEvent =Instance.new("RemoteEvent")
SpecialEvent.Name = "ServerCompleted"
SpecialEvent.Parent = Remotes

I also tried SpecialEvent.OnServerEvent, like it was before, and it still doesn’t work.

There’s no serverside errors, I’m 100% sure, and I even tried it via the command line and it still wont take it:

game.ReplicatedStorage.PSRemotes.ServerCompleted:FireServer(game.Players.DarkPixlz, 5, "Part", "test", false, "")

Thanks for any help, I’m clueless.

1 Like

There seems to be something firing the event repeatedly with no stop. Could you show the code that is firing the event?

You could try doing, game.ReplicatedStorage.PSRemotes:WaitForChild("ServerCompleted"), it seems that you are firing to the server and the server script is not handling anything so its just cancelling the event.

1 Like

Yes, it’s loading about ~7000 parts in my example but for some reaosn the script is not connecting.

There are about 400 lines inbetween when it connects and makes the event. this wouldn’t change much.

1 Like

I dont know if it’ll solve your issue but

Right here, you pass through game.Players.DarkPixlz for the first variable.

And then right here you only have one player variable with roblox automatically passes through with the local player it was fired from.

1 Like

That was the example I used in the command bar. This is what’s actually going through:

if not Asset:IsA("ModuleScript") then
				game.ReplicatedStorage.PSRemotes.ServerCompleted:FireServer(TimeLoaded, Asset.ClassName, Asset.Name,"Other", Asset)
			else
				game.ReplicatedStorage.PSRemotes.ServerCompleted:FireServer(TimeLoaded, Asset.ClassName, Asset.Name, "Module", Asset)
			end
1 Like

Update: did not fix it.

1 Like

I had a bit of a weird error which was making a lot of the end code unreachable and have fixed it.

2 Likes

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