Help with stopping an animation

  1. What do you want to achieve? Keep it simple and clear!

Fix an animation issue

  1. What is the issue? Include screenshots / videos if possible!

When I use :Stop on my animation it just keeps playing for some reason


local giving = false
local giveanim = script.give
	local hum = Player.Character.Humanoid
	local giveanimplay = hum:LoadAnimation(giveanim)

local giveanim = script.give
	local hum = Player.Character.Humanoid
	local giveanimplay = hum:LoadAnimation(giveanim)
	if input.KeyCode == Enum.KeyCode.Q then
		if giving == true then
		print("really bruh")
		giveanimplay:Stop()
		giving = false
		return end
		
		if giving == false then
		giveanimplay:Play()
		giving = true
		
1 Like

this should work :upside_down_face:

-- local player = game.Players.LocalPlayer
local giving = true
local giveanim = script.give
local hum = Player.Character:WaitForChild("Humanoid")
local giveanimplay = hum:LoadAnimation(giveanim)

game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
	if gameProcessedEvent then return end
	print()
	if input.KeyCode == Enum.KeyCode.Q then
		if giving == false then
			giveanimplay:Play(.5,10)
			giving = true
		elseif giving == true then
			print("really bruh")
			giveanimplay:Stop()
			giving = false
		end
	end
end)

1 Like

make sure to replace the ‘Player’ btw otherwise you’ll struggle getting the code to work

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.