I make an animation stuff and I need fire client, I made it, but when it runs it does error.

-- in script

game.ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("PunchAnimation"):FireClient(r6Ids, r15Ids, character, punched, punchWaitTime)

-- in local script

game.ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("PunchAnimation").OnClientEvent:Connect(function(r6Ids, r15Ids, character, punched, waitTime)
	if character.Name == player.Name and character:FindFirstChild("Torso") then
		print("passed test")
		local animation = AnimationLoader(character.Humanoid, r6Ids[math.random(#r6Ids)])
		wait(waitTime)
	--	animation:Stop()
		print("stopped punching")
	elseif character.Name == player.Name and character:FindFirstChild("UpperTorso") then
		print("passed test")
		local animation = AnimationLoader(character.Humanoid, r15Ids[math.random(#r15Ids)])
		wait(waitTime)
	--	animation:Stop()
		print("stopped punching")
	end
end)

it makes error like this: Unable to cast value to Object

Why and how to fix that? Please help.

3 comments

0

The first argument of FireClient must be the player

0

what first arguement

0

What is r6Ids. If it is not a player you can't make it the first argument of :FireClient().