Likewise, I've been working on a gun lately and i found out that some of the animations are a bit to hard to do (since i have to go back and forth sometimes), Is it possible for something to be like this:

for frame = 1,10 do
regright.C0 = regright.C0 * CFrame.Angles(-0.1250,0.0800,0.1000) *CFrame.new(0.0800,-0.0200,0) 
regleft.C0 = regleft.C0 * CFrame.Angles(0,0,-0.0150)
regtorso.C0 = regtorso.C0 * CFrame.Angles(0,-0.1200,0)
reghead.C0 = reghead.C0 * CFrame.Angles(0,-0.1000,0)
wait()
end

local regr = regright.C0 * CFrame.Angles(-0.1250,0.0800,0.1000) * CFrame.new(0.0800,-0.0200,0) 
local regl = regleft.C0 * CFrame.Angles(0,0,-0.0150)
local regt = regtorso.C0 * CFrame.Angles(0,-0.1200,0)
local regh = reghead.C0 * CFrame.Angles(0,-0.1000,0)

As you see, i've used a 'for' loop so i can make the animation for smoother, and below, shows me making the current positions a variable, My question is, can i use it afterwards? Like, few lines later, i've written this:

	for frame = 1,10 do
	regright.C0 = regr
	reghead.C0 = regh
	regtorso.C0 = regt
	regleft.C0 = regl
	wait()
	end

It worked though: It positions it nicely, although, the 'Animation' done by 'for' loop isn't working.. It just goes positions the player to that position without even having that smooth movement done by the for loop..

Is there anyway i can fix this? or to make this more efficient? Please help?

Help

5 comments

0

lerp.

0

That's actually a good idea :) ; would you mind expaining how i can use lerp on this things? :/

1

startcf:lerp(endcf, i) --i is the number u need to increment between 0 and 1 (0 being the start and 1 the end)

0

Thank you for the response, i tried doing: for frame = 0,1 do reghead.C0 = reghead.C0:lerp(regh, frame) regtorso.C0 = reghead.C0:lerp(regt,frame) regleft.C0 = regleft.C0:lerp(regl,frame) wait() end Although, this is the result: https://gyazo.com/7c7767429f9076631ab144d2ed66b2cb

0

The second argument of lerp is the percentage to the goal. Try doing for frame = 0,100 and then dividing the variable "frame" by 100 to get your percentage.