Rotating tool in the player's hand

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to have my tool smoothly rotate in the player’s hand
  2. What is the issue? Include screenshots / videos if possible!
    no idea how to do this
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked on the forum and used tweenservice, but that didn’t work

You could definitely modify the grip.

1 Like

You could attach it with a HingeConstraint set to Motor, but because that is physics based it may be glitchy.
You could easily just rotate the weld.C0 or weld.C1 orientation.

how would I do this, could you provide a example?

I think you should just modify the grip, it’s simple CFrame math.

1 Like

how would I do this, could you provide a example, at least give me an example.

Well, what are you trying to do? You didn’t provide it in the OP.

tool.Grip *= CFrame.Angles(0, math.pi, 0) -- rotates it 180 degrees
1 Like

Rotating smoothly;
You did search for tweenservice for the smoothness but didn’t search for the tool.Grip
(TweenService is a service that can gradually change a value into another value.)

Like the @Den_vers said; using the grip is very easy using CFrame math but you haven’t specified how you would want it to rotate.

Next to that; for the smoothest behaviour I recommend rotating it on the client (but then other users won’t be able to see this tool spinning unless those other clients also have scripts running locally spinning this tool, which is easy to do with something like collectionservice) but that is optional for smoothness.

right now, i’m trying to find out how to tween the grip, but it isnt working.

		local tween = TweenService:Create(Player.Character:FindFirstChild("ScopedRifle").GripRight,Tweenfo,{CFrame = CFrame.new(Player.Character:FindFirstChild("ScopedRifle").GripRight) *  CFrame.Angles(0, -1*math.pi/2, 0)})
		tween:Play()

It doesn’t like it when I play it., something about converting values to objects.

Once the goal is reached; it will stop moving. That’s why you would want a tween that loops.
However, I personally would use a function connected to RunService.Heartbeat since tweening CFrames often results in undesired movement directions in the orientation.

Then how would I do it, would you care to provide an example?

local Tool: Tool = (tool here)
local RotationPerSecond: number = 90 -- in degrees
local RunService: RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function(DeltaTime: number): ()
  Tool.Grip = Tool.Grip *  CFrame.Angles(0, math.rad(RotationPerSecond*DeltaTime), 0)
end)

Didn’t test yet and wrote it on my phone, though it should work.

It’s kind of spinning around perpetually, how do I stop it?

That was the behaviour I expected you to want; but I am not sure what behaviour you want it to have.

I want it to just rotate 90 degrees and stop

Is there any specific event you want to make it trigger? Is there any behaviour that makes the grip return to its original position? What is your plan?
E.g; User uses tool: Tool spins 90 degrees in 1 second and stops; tool returns into original position after a delay of half a second

just rotate it, then later rotate it back.

local Tool: Tool = (tool here)
local TweenService: TweenService = game:GetService("TweenService")
local Tween1: Tween = TweenService:Create(Tool, TweenInfo.new(0.5), {
  Grip = Tool.Grip *  CFrame.Angles(0, math.rad(90), 0)
})
local Tween2: Tween = TweenService:Create(Tool, TweenInfo.new(0.5), {
  Grip = Tool.Grip
})
Tween1.Completed:Connect(function(PlaybackState: Enum.PlaybackState): ()
  if PlaybackState ~= Enum.PlaybackState.Completed then
    return
  end
  task.wait(1)
  Tween2:Play()
end)

Tween1:Play()

After running play on Tween1 it should return using Tween2 after 1 second here