Have this script a forum user gave me (amanda) But this is what I get when I try using it

18:46:23.546 - LoadAnimation requires an Animation object 18:46:23.547 - Script 'Players.Player1.PlayerGui.LocalScript', Line 16 18:46:23.547 - Stack End

local keyPressed = 'Q'
local damage = 10
local animation = script:WaitForChild("Animation")

--

local uis = game:GetService('UserInputService')
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local human = char.Humanoid
local mouse = player:GetMouse()

uis.InputBegan:connect(function(input,event)
	if event then return end
	if input.KeyCode == Enum.KeyCode[keyPressed] then
		local track = human:LoadAnimation(anim)
		if mouse.Target then
			local target =  mouse.Target.Parent:FindFirstChild('Humanoid')
			if target then
				track:Play()
				target.Humanoid:TakeDamage(damage)
			end
		end
	end
end)

1 comment

0

Nowhere in the script do you have "anim" defined.