It keeps giving me this error: Unable to assign property AnimationId. Content expected, got Instance
Animations = {
[1] = 'rbxassetid://15992214997',
[2] = 'rbxassetid://15992215610',
[3] = 'rbxassetid://15992216518'
}
if combo < 3 then
combo += 1
else
combo = 1
end
local PunchAnimation = Instance.new("Animation")
PunchAnimation.AnimationId = Animations[combo] --Error line
local Animator = hum:FindFirstChildWhichIsA("Animator")
local PunchAnim = Animator:LoadAnimation(PunchAnimation)
It works when I straight up put the id instead of Animations[combo], but thats not what I want to do. It works fine with my hit animations using math.random, so idk why this wont work.
Are you sure that error lines up with that line? I would like to see both the full script as well as a screenshot of the output. It would also be nice if you could print Animations[combo] on the line before so we can see it’s tostring. The type would also be helpful:
The script is quite big, but heres the main part. Also, the error doesn’t bring me to that line when I click it, however I assumed the issue came from there.
Animations = {
[1] = 'rbxassetid://15992214997',
[2] = 'rbxassetid://15992215610',
[3] = 'rbxassetid://15992216518'
}
HitAnimations = {
[1] = 'rbxassetid://15992208488',
[2] = 'rbxassetid://15992204313',
[3] = 'rbxassetid://15992205885',
[4] = 'rbxassetid://15992207671'
}
KnockbackAnimations = {
Knockback = 'rbxassetid://15992209487',
Getup = 'rbxassetid://15992203262'
}
local Sounds = chr.Sounds
for i,v in pairs(Animations) do
local Anim = Instance.new("Animation")
Anim.AnimationId = v
Anim = hum:LoadAnimation(Anim)
Animations[i] = Anim
end
local combo = 0
local punching
local hit
local db = false
e.OnServerEvent:Connect(function(plr, value)
if value == "down" then punching = true
while punching == true do task.wait()
if statements.heavycombo.Value == true and
statements.stunned.Value ~= true and
statements.endlag.Value ~= true and
statements.ragdolled.Value ~= true and
statements.blocking.Value ~= true and
statements.attacking.Value ~= true
then
if db == false then db = true
hit = false
Values.Combos.LightCombo.Value = false
Values.Status.Attacking.Value = true
Whiff = true
--Status Effects
hum.WalkSpeed = 6
hum.JumpPower = 0
--Combo
if combo < 3 then
combo += 1
else
combo = 1
end
--Animations
print(Animations[combo])
print(type(Animations[combo]))
local PunchAnimation = Instance.new("Animation")
PunchAnimation.AnimationId = Animations[combo]
local Animator = hum:FindFirstChildWhichIsA("Animator")
local PunchAnim = Animator:LoadAnimation(PunchAnimation)