Make character spin constantly

I don’t think it will work with CFrames. It doesn’t allow us to move character. I have to go so I will be inactive. Post what you found.

Okay, I will try to just tweak my code a bit so it work

Last thing before I leave - I will also try to use Animation.

It’s not the best way but it will work ( make sure the animation’s priority is the highest ( Action4 )

Well, using Animation is indeed the best way. If you are going to create an animation that rotates Torso only (create keyframes for only Torso), then we get a great spin animation that does not override the player’s movement animation, but the best part is that it doesn’t prevent character from moving.
CFrames would only be effective for Humanoids that are in a fixed position, and Constraints like AngularVelocity and Torque are way too complicated.

Finished script:

local spinAnimTrack = nil
local animator = nil

tool.Equipped:Connect(function(mouse)
	local char = tool.Parent
	local humanoid = char:FindFirstChildWhichIsA("Humanoid")
	
	animator = Instance.new("Animator")
	animator.Name = "spin animator"
	animator.Parent = humanoid
	
	spinAnimTrack = animator:LoadAnimation(spinAnim)
	--spinAnim is my Animation instance, it is asigned higher in the script
	spinAnimTrack.Priority = Enum.AnimationPriority.Action4
	spinAnimTrack.Looped = true
	spinAnimTrack:Play()
end)

tool.Unequipped:Connect(function()
	if spinAnimTrack ~= nil then
		spinAnimTrack:Stop()
		spinAnimTrack.Stopped:Connect(function()
			animator:Destroy()
		end) --this is NECCESSARY, otherwise player animation glitches
	end
end)

i renamed topic from “How does Torque work” to “Make character spin constantly”

edit: We can even control speed by using spinAnimTrack.PlaybackSpeed

1 Like

Using animation is indeed the best way, if you don’t want to use BodyGyro.

It is deprecated, so there is no point.

I mean, it still work even when it’s deprecated.

So uh, I come back here to give you a better script.
Note : MAKE SURE IT’S LOCALSCRIPT BECAUSE THE CLIENT WON’T AFFECT THE PLAYER’S CHARACTER POSITION ONLY THE ROTATION OF THE CHARACTER.

-- Put inside of your desired tool, and also make sure it is LocalScript
local RunService = game:GetService("RunService")

local Tool = script.Parent
local HumanoidRootPart, Humanoid

local PerRotation, HowSmooth = 15, .15

local isEquipped = false

Tool.Equipped:Connect(function()
	isEquipped = true
	
	Humanoid = Tool.Parent:FindFirstChild("Humanoid")
	Humanoid.AutoRotate = false -- DON'T DELETE OR ELSE IT WILL CANCEL THE ROTATION
	HumanoidRootPart = Tool.Parent:FindFirstChild("HumanoidRootPart")
end)

Tool.Unequipped:Connect(function()
	isEquipped = false
	
	Humanoid.AutoRotate = true
end)

RunService.RenderStepped:Connect(function()
	if isEquipped ~= false then
		local final = HumanoidRootPart.CFrame * CFrame.Angles(0,math.rad(PerRotation),0)
		HumanoidRootPart.CFrame = HumanoidRootPart.CFrame:Lerp(final, HowSmooth)
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.