of     1   

XxevillittleninjaxX
#227704555Sunday, November 19, 2017 6:14 AM GMT

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
balcktack
#227704873Sunday, November 19, 2017 6:28 AM GMT

local player = game.Players.LocalPlayer local Tool = script.Parent local mouse = game.Players.LocalPlayer:GetMouse() local ButtonDown = true if player == nil then end Tool.Equipped:connect(function(mouse) Tool.Activated:connect(function() local playerChar = player.Character or player.CharacterAdded:wait() local Slash = {Animation = Tool:WaitForChild("Slash"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 1, Damage = {Min = 15, Max = 22}} if ButtonDown == true then wait(0.1) repeat wait(1) until playerChar:WaitForChild("Humanoid") ~= nil -- i am not familiar with repeat so if i get this wrong please tell me playerChar.Humanoid:LoadAnimation(Slash) -- i am also not familiar with animation so again please tell me if this is wrong Slash:Play() ButtonDown = false end end) end)
XxevillittleninjaxX
#227705730Sunday, November 19, 2017 7:15 AM GMT

Ah thank you so much i fixed the animation and thanks for cleaning up my messy script :P

    of     1