Why is this remote event not firing?

It’s a server script to a local script

Basically the event isn’t firing

output: 16:39:12.445 - FireClient: player argument must be a Player object

server script

local x = script.Parent.Parent.Time

if x.Value == 1 then
	function onTouch(part) 
		local humanoid = part.Parent:FindFirstChild("Humanoid") 
		if (humanoid ~= nil) then	
			humanoid.Health = humanoid.Health - 10
			script.Parent.Parent:Destroy()
			local b = math.random(1,2)
			if b == 2 then
				local player = part.Parent
				local RE = game:GetService("ReplicatedStorage") -- here 
				local Event = RE.Combat
				Event:FireClient(player)
				
				player.LowerTorso.Anchored = true
				
				wait(5)
				player.LowerTorso.Anchored = false
			end			
	end 
	end
end
script.Parent.Touched:connect(onTouch)

local script

local RE = game:GetService("ReplicatedStorage")
local Event = RE.Combat 

Event.OnClientEvent:Connect(function(player) -- here
	game.Workspace:ClearAllChildren()
	local humanoid = player.Humanoid
	local character = player.Character    
	
	local setEnabled = humanoid:GetState() ~= Enum.HumanoidStateType.Physics
	humanoid:ChangeState(setEnabled and Enum.HumanoidStateType.Physics or Enum.HumanoidStateType.GettingUp)
	character.Animate.Disabled = setEnabled
end)
1 Like

Touched events will return the part that touched the object. If this is a part of a player, then part.Parent would be a Character instance, not a Player instance. You can get a Player instance from a Character instance though with game.Players:GetPlayerFromCharacter(part.Parent).

2 Likes