I made a script where you press the key Q a part is created around the player. For some reason when I made the animation it doesn't work?
plr = game.Players.LocalPlayer
local char = plr.Character
--//Animation
local shield = Instance.new('Animation')
shield.AnimationId = 'http://www.roblox.com/asset/?id=959285490'
local shieldloader = plr.Character.Humanoid:LoadAnimation(shield)
--//
mouse = plr:GetMouse()
debounce = false
function onKeyPress(shield,userInputState,inputObject)
if userInputState == Enum.UserInputState.Begin then
wait()
if not debounce then
debounce = true
plr.Character.Humanoid.WalkSpeed = 0
plr.Character.Humanoid.JumpPower = 0
s = Instance.new('Part')
s.Anchored = true
s.CanCollide = false
s.Size = Vector3.new(25,25,25)
s.Transparency = 0.7
s.BrickColor = BrickColor.new('Cyan')
s.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,0)
s.Parent = workspace
shieldloader:Play()
end
elseif
userInputState == Enum.UserInputState.End then
plr.Character.Humanoid.WalkSpeed = 16
plr.Character.Humanoid.JumpPower = 50
s:Destroy()
wait()
end
wait(10)
debounce = false
end
game.ContextActionService:BindAction('keyPress',onKeyPress,false,Enum.KeyCode.Q)
Error: LoadAnimation requires the Humanoid object (luicasas.Humanoid) to be a descendant of the game object

1 comment
Didn't work, same error. Thanks though.