Client won't receive event

I’m trying to fire a remote event to tell the client to empty the players backpack if they hit a part but it won’t receive anything(i use prints to tell if it works)

Blockquote local event = game:GetService(“ReplicatedStorage”).Events:WaitForChild(“CheeseDeposit”)
print(“OK”)
event.OnClientEvent:Connect(function(plr)
print(“Recieved”)
print(plr)
plr.Backpack:ClearAllChildren()
end)

Client

Blockquote script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local event = game:GetService(“ReplicatedStorage”).Events:WaitForChild(“CheeseDeposit”)
event:FireClient(plr)
print(“sent”)
end
end)

server

When you receive a RemoteEvent from the server on the Client, you don’t get passed the player argument. If you want the player on the Client you can use, game:GetService("Players").LocalPlayer. Though, why not just remove the backpack contents on the server?

Clear it from the server instead. Here:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		if not plr then return end
		
		plr.Backpack:ClearAllChildren()
		
	end
end)
1 Like

The player was me messing around and i tried the server but it didn’t work, i had another post about it and nobody could figure it out… + i still need to update the CheeseCount

and i know it sends because the sent print statement prints