I’ve already tried to look up for other topics,like mine,but i couldn’t find the right answer.Please,can someone find an error in this local script?
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://138509202688208"
local hum = script.Parent:WaitForChild('Humanoid')
local humanoid = hum:WaitForChild("Animator")
local erm = humanoid:LoadAnimation(animation)
erm:Play()
local animation = Instance.new("Animation")
local UserInputService = game:GetService("UserInputService")
animation.AnimationId = "rbxassetid://138509202688208"
local hum = script.Parent:WaitForChild('Humanoid')
print("Humanoid find")
local humanoid = hum:WaitForChild("Animator")
print("Animator find")
local erm = humanoid:LoadAnimation(animation)
print("Animation loaded")
UserInputService.InputBegan:Connect(function(Key)
if Key.KeyCode == Enum.KeyCode.C or Key.KeyCode == Enum.KeyCode.LeftShift then
erm:Play()
print("Animation played")
end
end)
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://138509202688208"
local hum = script.Parent:WaitForChild('Humanoid')
local humanoid = hum:WaitForChild("Animator")
local erm = humanoid:LoadAnimation(animation)
task.wait(0.5)
erm:Play()
I see this happen a lot, if you play an animation right when you load an animation, chances are, it wont play, so add a task.wait
Ok so this is probably why it isnt working.
In roblox you cant use other peoples animations, unless the game you are editing is under a group, and the animation was uploaded to said group, otherwise I dont believe you can use the animation