You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am trying to make a script which does animations by getting the poses in a keyframe and then setting the Motor6D transform of the player. -
What is the issue? Include screenshots / videos if possible!
I store my poses inside of an array but when I use ipairs, it does not loop in order. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve looked through some developer forum posts but I haven’t found a solution yet.
This is the KeyframeSequence structure below.
I have put my code below.
local Equip = {
{
LeftUpperArm = { Equip.Keyframe1.HumanoidRootPart.LowerTorso.UpperTorso.LeftUpperArm, "LeftShoulder" },
LeftLowerArm = { Equip.Keyframe1.HumanoidRootPart.LowerTorso.UpperTorso.LeftUpperArm.LeftLowerArm, "LeftElbow" },
RightUpperArm = { Equip.Keyframe1.HumanoidRootPart.LowerTorso.UpperTorso.RightUpperArm, "RightShoulder" },
RightLowerArm = { Equip.Keyframe1.HumanoidRootPart.LowerTorso.UpperTorso.RightUpperArm.RightLowerArm, "RightElbow" }
},
{
RightUpperArm = { Equip.Keyframe2.HumanoidRootPart.LowerTorso.UpperTorso.RightUpperArm, "RightShoulder" },
RightLowerArm = { Equip.Keyframe2.HumanoidRootPart.LowerTorso.UpperTorso.RightUpperArm.RightLowerArm, "RightElbow" }
},
{
LeftUpperArm = { Equip.Keyframe3.HumanoidRootPart.LowerTorso.UpperTorso.LeftUpperArm, "LeftShoulder" },
LeftLowerArm = { Equip.Keyframe3.HumanoidRootPart.LowerTorso.UpperTorso.LeftUpperArm.LeftLowerArm, "LeftElbow" },
RightUpperArm = { Equip.Keyframe3.HumanoidRootPart.LowerTorso.UpperTorso.RightUpperArm, "RightShoulder" },
RightLowerArm = { Equip.Keyframe3.HumanoidRootPart.LowerTorso.UpperTorso.RightUpperArm.RightLowerArm, "RightElbow" }
}
}
script.Parent.TextButton.Activated:Connect(function()
RunService.Stepped:Connect(function()
for i, v in ipairs(Equip) do
print(i)
print(v)
for i, v in pairs(v) do
for n = 0, 1 do
Player.Character[i]:FindFirstChild(v[2]).Transform = Player.Character[i]:FindFirstChild(v[2]).Transform:Lerp(v[1].CFrame, n)
end
end
wait(0.5)
end
end)
end)
Edit: I have also put what I get in my output below.