I'm currently trying to make my own FPS gun kit/engine and I'm running into a few issues. First off, I'm having trouble with tweening a few parts. The parts that I'm trying to tween are the (This is an M4) Bolt which is a union, and tween the mag. I'm having issues with this and I'm about to blow up. How do I get these dang things to tween smoothly like in Phantom Forces?
Like SandlineTactical said, sadly there are no ways to tween parts. But there are ways to get around this. You see, roblox has added built in objects/functions for each type of class of objects (e.x. Tweening and GUI, BodyMover's and Parts).
Since we're focusing on physical objects (parts), we'll use a BodyMover to smoothly animate the parts.
--Specificly, we'll use BodyVelocity to control what direction we want to move that object and how fast that movement will be.
Now the only thing that's left is to change the Velocity in a certain axis, in a certain sequence, to simulate an animation.
But let's say your more used to tweening than you are BodyMover's? How would you format a sequence (animation), but with the 4 arguments that are always within a tween?
--Let's break this problem down into a couple parts:
1) Since tweening is a function, we'll create a custom function to run specific lines of code.
2) Each argument in the tween itself will be the following:
--The starting position
--The ending position
--The increment for how much the object will cover
--The how frequent will the increment be aplied (to it's position)
The final product should look like:
Part = workspace.Part OverLoad = false function Tween(part,start,end,increment,time) if Part:FIndFirstChild(¨BodyVelocity¨) == nil then Instance.new(¨BodyVelocity¨,Part).Velocity = Vector3.new(0,0,0) end Part:WaitForChild(¨BodyVelocity¨) OverLoad = true wait() OverLoad = false local Rate = start - end * Vector3.new(time/increment,time/increment,time/increment) --quote me if I´m wrong on this part local LoopStatus = true Part.BodyVelocity = Rate while LoopStatus == true do if Part.Position == end then Part.BodyVelocity = Vector3.new(0,0,0) LoopStatus = false end if OverLoad == true then Part.BodyVelocity = Vector3.new(0,0,0) LoopStatus = false end end end
Apologies, but > tweening can only be done to GUI's. My only suggestion is to use CFrames or the roblox animation editor.