I do not know how to fix this, help is appreciated!
Client-Sided Script:
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local animation = tool:WaitForChild("Animation")
local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local remote = tool:WaitForChild("DamageEvent")
local char = plr.Character or plr.CharacterAdded:Wait()
local plrhumanoid = char:WaitForChild("Humanoid")
tool.Equipped:Connect(function(mouse)
print("Equipped.")
tool.Activated:Connect(function()
handle.Touched:Connect(function(hit)
local humanoid = hit.Parent:WaitForChild("Humanoid")
local humanoidRootPart = hit.Parent:WaitForChild("HumanoidRootPart")
if humanoid and humanoidRootPart then
print("Humanoid found: " .. hit.Parent.Name)
local newAttachment = Instance.new("Attachment")
local newVectorForce = Instance.new("VectorForce")
newVectorForce.Attachment0 = newAttachment
newVectorForce.Parent = humanoidRootPart
newAttachment.Parent = humanoidRootPart
newVectorForce.Force = Vector3.new(0,0,-1000)
local track = plrhumanoid:WaitForChild("Animator"):LoadAnimation(animation)
track:Play()
remote:FireServer(humanoid,25)
else
print("Humanoid was not found.")
end
end)
end)
end)
Server-Sided Script:
local remote = script.Parent:WaitForChild("DamageEvent")
remote.OnServerEvent:Connect(function(player,humanoid,damage)
humanoid:TakeDamage(damage)
end)