local player = game.Players.LocalPlayer
local Tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
if player == nil then end
function Ani(mouse)
local playe = game.Players.LocalPlayer
local playerChar = playe.Character or playe.CharacterAdded:wait()
local Slash = {Animation = Tool:WaitForChild("Slash"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 1, Damage = {Min = 15, Max = 22}}
local ButtonDown = true
local Tool = script.Parent
if Tool.Equipped and ButtonDown == true then
wait(0.1)
repeat wait(1) until playerChar:WaitForChild("Humanoid") ~= nil
playerChar.Humanoid:LoadAnimation(Slash)
Slash:Play()
ButtonDown = false
else
end
end
mouse.Button1Down:connect(Ani)
The error that comes up is Unable to cast nil value I'm trying to play an animation whenever the player clicks with a tool out any help would be much appreciated |