OnClientEvent not working properly?

I have an onclientevent atm that I’m going to be using to shake a players screen when they are hit, but atm it does not fire properly. Can someone explain what im doing wrong? (This is all inside of a tool btw if that helps)

server

hitEvent.OnServerEvent:Connect(function()
	
	print("Mouse1")
	M1hitbox:HitStart(1.5)
	
	
	M1hitbox.OnHit:Connect(function(hit, humanoid, player)
		
		local hitEnemy = hit.Parent
	
		local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
		
		print("1")
		
		shakeEvent:FireClient(player)
		
		print("2")

client

local function working()
	print("working")
end

shakeEvent.OnClientEvent:Connect(working)

console output:

  11:30:35.820  Mouse1  -  Server - Server:44
  11:30:36.521  1  -  Server - Server:54
  11:30:36.521  2  -  Server - Server:58
  11:30:36.521  LeftUpperArm  -  Server - Server:62

Where is the shake event? you might be getting different remotes from client/server

edit:(also print right before ShakeEvent gets binded on the client to make sure its getting binded)

The shake event is in the same tool as the script and local script and defining the shake event is the same in both tools

local shakeEvent = weapon:WaitForChild("PlayerHit")

what do you mean print before the shake event gets binded? like print before the function in the local script like this?

local function working()
	print("working")
end

print("test")
shakeEvent.OnClientEvent:Connect(working)

yeah, when you do :Connect it binds the function to the event, also did it print test?

1 Like

I fixed it earlier, basically the only issue was that the remote event apparently needs to be in replicated storage in order for it to fire from server to client lol