Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why Isn't My Guarding Animation Not Stopping??

I'm making a mini basketball game project and I want to add guarding so I made a script for the animation to play but why isn't it stopping?? Please help.

local plr = game.Players.LocalPlayer
local chr = plr.Character
local humanoid = chr.Humanoid
local uis = game:GetService("UserInputService")

local animid = 'rbxassetid://3312318024'
local db = true

uis.InputBegan:connect(function(input,gpe)
	if gpe then
		return
	end
	if input.KeyCode == Enum.KeyCode.G then
		local anim = Instance.new("Animation")
		anim.AnimationId = animid
		local LoadAnimation = humanoid:LoadAnimation(anim)
		LoadAnimation:Play()
	end
end)

uis.InputEnded:connect(function(input,gpe)
	if gpe then
		return
	end
	if input.KeyCode == Enum.KeyCode.G then
		db = false
	    local anim = Instance.new("Animation")
		anim.AnimationId = animid
		local LoadAnimation = humanoid:LoadAnimation(anim)
		anim:Destroy()
		db = true
	end
end)

1 comment

0

Best Game Ever!

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.