Why Is The Weapon Hold Animation Playing When I Unequip The Weapon? [UNSOLVED]
I am making a zombie game with custom guns and animations made by me the animations play just fine but I’m having trouble scripting when the animations actually play this is my first time making and scripting animations here is my code, Thanks:
001 | local player = game:GetService( 'Players' ).LocalPlayer |
003 | local character = player:FindFirstChild( 'Character' ) |
005 | if not character or not character.Parent then |
007 | character = player.CharacterAdded:Wait() |
011 | local humanoid = character:WaitForChild( "Humanoid" ) |
013 | local animator = humanoid:WaitForChild( "Animator" ) |
015 | HoldHK 33. OnClientEvent:Connect( function () |
017 | local HoldHK 33 = Instance.new( "Animation" ) |
021 | local Hold = animator:LoadAnimation(HoldHK 33 ) |
035 | local anim = Instance.new( 'Animation' ) |
039 | holdHK = animator:loadAnimation(anim) |
045 | holdHK:AdjustSpeed(. 5 ) |
049 | ActuallyHoldingHk 33. Value = true |
055 | local function plswork() |
057 | ActuallyHoldingHk 33. Value = false |
059 | holdHK:AdjustSpeed(. 5 ) |
063 | local function reloadHK 33 () |
065 | holdHK:AdjustSpeed(. 5 ) |
069 | local reloadEvent = Instance.new( 'Animation' ) |
073 | local work = animator:LoadAnimation(reloadEvent) |
085 | local function HK 33 Running() |
087 | RunningWithHK 33 BoolValue.Value = true |
089 | holdHK:AdjustSpeed(. 5 ) |
095 | ActuallyHoldingHk 33. Value = false |
097 | ActuallyHoldingHk 33. Value = false |
099 | local runAnim = Instance.new( 'Animation' ) |
103 | Running = animator:LoadAnimation(runAnim) |
107 | Running:AdjustSpeed(. 5 ) |
111 | Running:AdjustSpeed( 0 ) |
115 | function HK 33 QuitRunning() |
121 | Running:AdjustSpeed(. 5 ) |
125 | RunningWithHK 33 BoolValue.Value = false |
129 | HK 33 StoppedRunning.Event:Connect(HK 33 QuitRunning) |
131 | HK 33 RunBindable.Event:Connect(HK 33 Running) |
133 | unequipHK 33. Event:Connect(plswork) |
135 | HK 33 ReloadBindable.Event:Connect(reloadHK 33 ) |
Whenever I unequip the gun the hold animation and the crosshair appear as if I still have the tool equipped, Thanks.