local TweenService = game:GetService("TweenService")
local TweenerInfo = TweenInfo.new(0.35, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, true)
local shotAnimation = TweenService:Create(script.Parent.Gun.Barrel.qCFrameWeldThingy,
TweenerInfo,
{C1 = CFrame.new(Vector3.new(0, 0, script.Parent.Gun.Barrel.qCFrameWeldThingy.C1.CFrame.LookVector.Z - 0.4), script.Parent.Gun.Barrel.qCFrameWeldThingy.C1.CFrame.Orientation)})
shotAnimation:Play()
My bad. Remove the CFrame between the C1 and LookVector.
still the same error… Barrel.qCFrameWeldThingy.C1.LookVector.Z
wait im going to try it with the cframe removed on the other line too, alright when i do that it says orientation is not a valid member of cframe
Just try searching other posts.
I typed in “gun slide animation” and came up with a few posts about it, one that mentions tweening in the description.
right but like I stated in my post I cant use animations, I need to use tweenservice.
any idea for a fix since that didnt work?
I mentioned tweenservice in that post as well…
Could you give me a place file so I can look at it and do my trial and errors?
Also, what type of weld is it? That’s a contribution to the problem. If it was a WeldConstraint, it wouldn’t have either C1 or C0.
instead of using C1 you can possibly using CFrame instead
local shotAnimation = TweenService:Create(script.Parent.Gun.Barrel,
TweenerInfo,
{C1 = CFrame.new(Vector3.new(0, 0, script.Parent.Gun.Barrel.CFrame.LookVector.Z - 0.4), script.Parent.Gun.Barrel.CFrame.Orientation)})
Zylo all you have to do is create a motor6d to the weapons handle and animate it accordingly with the motor6d.
the motor6d allows you to freely move the slide part anyway u want forward backward etc .
the use of animations to move the slide is very simple yet not so hard to accomplish.
i have done it several times etc in my gun system.
DO NOT WELD ANIMATED PARTS u motor6d them.
and tweening parts of weapons is not really ideal
if this was ur answer please set this as the solution.
IF YOU WANT TO LEARN ABT THIS PLS GO HERE!
its a normal weld, no weldconstraint.
but I need my thing to be in a script and with no animations.
why? just add an animation and load the animation each time ur shooting event is fired.
is it not possible with a script?
it is but id say do animations bro. using scripts is unneeded and not really the best thing.
loading animations is much easier then tweening or cframing stuff.
Well you could do a motor 6d animation that plays every time you fire the tool. I Reconmend to learn motor 6d animations.
I want to use cframes because I have tons of guns and going in and animating the slide on each one is harder than just a script.
like i said its easier animating the weapons instead of cframing a welded part…
So… If anyone still want to know i did by adding to my gun Model a “slide Start” part and a “slide End”
And i tween the slide motor6d between those two parts. since this parts are already motor6d’d to the gun i dont have to worry about the slider drifting around.
The code looks like this:
function module.ReciprocateGun(gun:Model,gunData:WeaponsDataShared.Gun)
local gunReciprocatorMotor :Motor6D = gun:FindFirstChild('ReciprocatorMotor6D',true)
local reciprocatorStartMotor:Motor6D = gun:FindFirstChild('ReciprocatorStartMotor6D',true)
local reciprocatorEndMotor:Motor6D = gun:FindFirstChild('ReciprocatorEndMotor6D',true)
if gunReciprocatorMotor and reciprocatorEndMotor and reciprocatorStartMotor then
print('reciprocate')
local startGoal = {
C0 = reciprocatorEndMotor.C0
}
local endGoal = {
C0 = reciprocatorStartMotor.C0
}
local info = TweenInfo.new((0.08 / 2) , Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local tweenStart:Tween = TweenService:Create(gunReciprocatorMotor, info, startGoal)
local tweenEnd:Tween = TweenService:Create(gunReciprocatorMotor, info, endGoal)
tweenStart:Play()
tweenStart.Completed:Connect(function()
tweenEnd:Play()
end)
end
end
Quick note:
I weld my parts at run time with a custom welding function and i did this because i am doing a procedural FPS framework for my game and sice i am a one man team i cannot afford the time to animate guns.