How would I fix this stun event -- Unable to cast value to Object

it says Unable to cast value to Object

‘’
local repStore = game:GetService(“ReplicatedStorage”)
local remote = repStore:WaitForChild(“ToolStun”)

remote.OnServerEvent:Connect(function(plr, stunType)
local char = plr.Character
local humanoid = char:FindFirstChild(“Humanoid”)
print(humanoid, char)
local MarkerEvent = humanoid.MaxHealth * 0.1 – 10%
local stopStun = humanoid.MaxHealth * 0.2 --20%

local stun = char:GetAttribute("Stunned")

if  humanoid.Health <= MarkerEvent  then
	
	print(humanoid.Health)
	stun = true
	remote:FireClient("Stun")
	humanoid.AutoRotate = false
	
elseif humanoid.Health >= stopStun then

	print(humanoid.Health)
	humanoid.AutoRotate = true
	--remote:FireClient("StunStop")
	stun = false
	
end

end)
‘’

You need to put the player object as the first argument in FireClient

1 Like