--Server Script
local tool = script.Parent
local clickEvent = tool:WaitForChild("ClickEvent")
local localTrip = game.ReplicatedStorage:WaitForChild("LocalTripEvent")
local clickEventConnection
local function onEquip()
clickEventConnection = clickEvent.OnServerEvent:Connect(function(player)
local hitbox = Instance.new("Part", player.Character)
hitbox.CanCollide = false
hitbox.Size = Vector3.new(3,1,2)
hitbox.CFrame = player.Character.PrimaryPart.CFrame + (player.Character.PrimaryPart.CFrame.lookVector*3 + Vector3.new(0,1,0))
hitbox.Transparency = 0.5
game:GetService("Debris"):AddItem(hitbox, 0.1)
hitbox.Touched:Connect(function(part)
if part.Parent == player.Character then return end
local human = part.Parent:FindFirstChild("Humanoid")
if human then
localTrip:FireClient(human.Parent.Parent)
hitbox:Destroy()
else
hitbox:Destroy()
end
end)
end)
end
local function onUnequip()
clickEventConnection:Disconnect()
end
tool.Equipped:Connect(onEquip)
tool.Unequipped:Connect(onUnequip)
--LocalScript
local tool = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local humanoid = player.Character:WaitForChild("Humanoid")
local anim = tool:WaitForChild("PushAnim")
local number = 6
local debounce = false
local clickEvent = tool:WaitForChild("ClickEvent")
local tripEvent = game.ReplicatedStorage:WaitForChild("LocalTripEvent")
local function onActivate()
if debounce then return end
debounce = true
local animtrack = player.Character.Humanoid:LoadAnimation(tool.PushAnim)
animtrack.Priority = Enum.AnimationPriority.Action
animtrack:Play()
animtrack.KeyframeReached:Connect(function(keyframeName)
if keyframeName == "Push" then
clickEvent:FireServer()
end
end)
for i=1,5 do
number = number - 1
tool.Name = number
wait(1)
end
tool.Name = "Push"
number = 6
debounce = false
end
tool.Activated:Connect(onActivate)
tripEvent.OnClientEvent:Connect(function()
humanoid.Parent.HumanoidRootPart.Velocity = humanoid.Parent.HumanoidRootPart.CFrame.lookVector * -50
humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
print("success")
end)
Everytime I run this pushing script, the FireClient() (line 19) sends a error "player argument must be a player object". How do I fix this?

1 comment
humanoid.Parent.Parent is the workspace.