Remote event not always working

In this screenshot I have a server script that prints “firing ded” and fires a remote event to a local script which prints “someone died in team(…)”, however you can see very clearly that the local script doesnt always detect when the remote event fires and only the server script ends up printing. How can I fix this?

First off, could you show me both local and server script?

1 Like

local script:

	local function addFighter(f)
		table.insert(fighters, f)
		table.insert(active, f)
		fighter = f
			table.remove(active, table.find(active, f))
			print('someone died in team '..i..',',#active,'left')
			if #active < 1 then

server script (in humanoid)

local ded = false

	if health <= 0 and not ded then
		ded = true
		print('firing ded')

uhm isnt the client supposed to fire to the server

the server is firing to the client in my script

and also try using a loop function

1 Like

I tried using a while loop before and it didn’t work

I have many questions about this.

Why did you parent a server script to a RemoteEvent?

What is the dataType of f? This might be the root cause of the issue.

woah lol i didnt even notice that lmao. Ur not supposed to make the script a child to a remote event

1 Like

Also the function needs to check if the thing like the rig has a humanoid in it

1 Like

f is an NPC model. I parented the server script to remote event so that I could just use f.Humanoid.ded instead of f.Humanoid.Script.ded

what’s wrong with that, does it affect the event in any way? if so, what is the proper way to set it up?

where is the remote event located

the remote event is inside of the humanoid.

Remote Events should be in a place where both the server and client can access. In practical terms, it means they should be in game.ReplicatedStorage.

1 Like

exactly said what i was about to say lol

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