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

LoadAnimation:() suddenly has stopped working. Any answers?

so i have this knife weapon im working on yet the attack animation just stopped working, it worked before but it suddenly just started giving this error message:

Players.munkuush.Backpack.Knife.Script:25: attempt to index boolean with 'Play'

I am confused, anyways, heres my code:

local player = script.Parent.Parent.Parent
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
wait()
local idle = hum:LoadAnimation(game.ReplicatedStorage.Knife_Idle)
local attack = hum:LoadAnimation(game.ReplicatedStorage.Knife_Attack)
local cooldown = false
local attack = false

script.Parent.Equipped:Connect(function()
	idle:Play()
end)


script.Parent.Unequipped:Connect(function()
	idle:Stop()
end)


script.Parent.Activated:Connect(function()
	if cooldown == false then
		cooldown = true
		attack = true
		idle:Stop()
		attack:Play()
		wait(.24)
		attack:Stop()
		idle:Play()
		wait(0.16)
		attack = false
		cooldown = false
	end
end)

script.Parent.Hitbox.Touched:Connect(function(hit)
	local human = hit.Parent:WaitForChild("Humanoid")
	if human.Parent ~= char then
		if attack == true then
			attack = false
			human:TakeDamage(15)
		end
	end
end)

1 answer

Turns out im an idiot, i had 2 variables named 'attack'. Sorry for being dumb

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