So I have this animation that basically looks like smaller parts growing out of a big part. I want it to be some kind hand/blade weapon thingy. Using this script I made:
local source = script.Parent -- the part where parts will grow out of
function growAniamtion(source, speed, multiplier, multiplier2) -- the animation function
local part1 = Instance.new("Part", workspace) -- the first part to grow
part1.CFrame = source.CFrame
part1.Size = source.Size
part1.Name = "part1"
part1.Anchored = true
while part1.Size.x <= source.Size.x and part1.Size.z <= source.Size.z and part1.Size.y <= source.Size.y*multiplier do --animating, while the part is smaller than the source part and while it is not taller than the source height * multiplier
wait(speed)
part1.Size = part1.Size - Vector3.new(0.2,0,0.2) -- lower the size
part1.Size = part1.Size + Vector3.new(0,0.2,0) -- increase the height
print(part1.Size)
end
local part2 = Instance.new("Part", workspace) --the second part to grow
part2.CFrame = source.CFrame
part2.Size = part1.Size
part2.Name = "part1"
part2.Anchored = true
while part2.Size.x <= part1.Size.x and part2.Size.z <= part1.Size.z and part2.Size.y <= part1.Size.y*multiplier2 do
wait(speed)
part2.Size = part2.Size - Vector3.new(0.2,0,0.2) -- lower size
part2.Size = part2.Size + Vector3.new(0,0.2,0) -- increase height
print(part2.Size)
end
end
growAniamtion(source, 0.8, 1.5, 1.2) --executing the function
This works fine and gives me this:
However If I rotate the source part then the animation gets messed up:
What can I do to remedy this?
