Tween Gun Reload Animation Help

Hello! So im super new to roblox developing and recently started a VERY simple fps game to help me learn. Ive come into an issue that I cant seem to figure out how to get past. So I want to implement a reloading and ammo system (currently you can just shoot as much as you want). I do want to do anything crazy for the animation so I was looking for more of a spin.

In my main script:

elseif key.KeyCode == Enum.KeyCode.R then
	local TI = TweenInfo.new(0.5, Enum.EasingStyle.Sine)
	local goal = {}
	goal.Orientation = Vector3.new(0,360,0)
	local tween = Tween:Create(WeaponInHand.PrimaryPart, TI, goal):Play()
end

It tests for when the R key is pressed, then creates a tween that the goal would be to spin the primary part of the model (gun) 360 degrees on the y axes.

WeaponInHand is a variable set to the model of the current gun in the players hand.

A video of what is happening:

Other information:

  • The Gun is parented to the player’s current camera
  • I belive what is happening is because of the angle im looking in game. Correct me if im wrong.
  • A screenshot of the gun model:

Let me know if there is any more code or information you would need to see

Thanks,

  • Alex

Bump. Still have not found a fix.

What you exactly want the thing do here? Just to confirm.

The goal is for the gun to spin, just a very simple reload animation.

The TweenInfo Time aka 2nd paramater is too fast, try to increase the value.

i dont know if its what you want since im very confused there

Whats confusing about this. All I am looking for is help is how I can rotate/ spin the gun using tweenservice. The 2nd parameter is the Enum.EasingStyle.Sine so im guessing you mean 0.5.

Annoyingly my roblox account does not seem to let me in. Ive contacted support so ill trying increasing the value when it lets me in.

Sadly I have still not found I fix, I think im getting closer but still nothing. I now realized that if I rotate the primary part its not going to do anything but rotate only that specific part.

For those confused on what im looking for this is a reddit video I found of someone spinning their nerf gun how im hoping to animate the guns in my game:

Im not sure how in the world I would rotate a model in a 360. I think i may have gotten closer with this article but it still seems to give me trouble.

My current code:

local TI = TweenInfo.new(0.5, Enum.EasingStyle.Sine)
		local rotatedCFrame = CFrame.Angles(0, math.rad(180), 0)
		local goal = {}
		goal.Rotation = WeaponInHand.PrimaryPart.CFrame:ToWorldSpace(rotatedCFrame)
		local tween = Tween:Create(WeaponInHand.PrimaryPart, TI, goal):Play()

Error: TweenService:Create property named 'Rotation' cannot be tweened due to type mismatch (property is a 'Vector3', but given type is 'CoordinateFrame')

I know this means its looking for Vector3, but I dont know how I would get this to work with it.

Anything helps lol, thanks!