From what I understand, I'm doing something wrong with the animation.
local player = game.Players.LocalPlayer local blast = game.ReplicatedStorage.Blast local mouse = player:GetMouse() local clone = game.ReplicatedStorage.Blast:Clone() local humanoid = player.Character.Humanoid local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=2065147076" --------------------------------------------------Variables mouse.KeyDown:connect(function(key) if not Enabled then return end key = key:lower() if key == "q" then local playAnim = humanoid.LoadAnimation(anim) playAnim:Play() local f = blast blast.Parent = workspace local BodyVelocity = Instance.new("BodyVelocity", blast) BodyVelocity.maxForce = Vector3.new(math.huge,math.huge,math.huge) BodyVelocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector *120 game.Debris:AddItem(q, 2) end Mouse.KeyUp:connect(function(key) key = key:lower() if key == "q" then end end
On line 15, it should be ':' instead of '.', or humanoid:LoadAnimation() instead of humanoid.LoadAnimation. If you look at the roblox wiki, you can use the example code as a hint.
Here is the new code:
local player = game.Players.LocalPlayer local blast = game.ReplicatedStorage.Blast local mouse = player:GetMouse() local clone = game.ReplicatedStorage.Blast:Clone() local humanoid = player.Character.Humanoid local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=2065147076" --------------------------------------------------Variables mouse.KeyDown:connect(function(key) if not Enabled then return end key = key:lower() if key == "q" then local playAnim = humanoid:LoadAnimation(anim) playAnim:Play() local f = blast blast.Parent = workspace local BodyVelocity = Instance.new("BodyVelocity", blast) BodyVelocity.maxForce = Vector3.new(math.huge,math.huge,math.huge) BodyVelocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector *120 game.Debris:AddItem(q, 2) end Mouse.KeyUp:connect(function(key) key = key:lower() if key == "q" then end end