Make character spin constantly

I want to make a script to constantly rotate player character using Torque. One small issue is that I found literally zero information on how this works and no examples.

Script:

velocity = Instance.new("Torque")
velocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
velocity.Torque = Vector3.new(0, 10, 0)
attach = Instance.new("Attachment")
attach.Name = "spin attachment"
attach.CFrame = CFrame.new()
attach.Parent = char:WaitForChild("HumanoidRootPart") --char is asigned before the code block
velocity.Attachment0 = attach
1 Like

Server script one :

-- Put script in StarterCharacterScripts

local Character = script.Parent

local Torque = Instance.new("Torque", Character:FindFirstChild("HumanoidRootPart")) -- Make torque, totally very important information
Torque.RelativeTo = Enum.ActuatorRelativeTo.Attachment0 -- I don't even know what the heck this thing does
Torque.Torque = Vector3.new(0,0,1200) -- Torque's strength and the direction of the "Torque" 

local Attachment0 = Instance.new("Attachment", Character:FindFirstChild("HumanoidRootPart"))
Attachment0.CFrame = CFrame.new(Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector + Vector3.new(0,Character:FindFirstChild("HumanoidRootPart").Size.Y/2,0)) * CFrame.Angles(math.rad(90),0,0) -- Make the attachment go on top of the HumanoidRootPart

Torque.Attachment0 = Attachment0

And the local script version one :

-- Put script in StarterPlayerScripts

local Player = game:GetService("Players").LocalPlayer

repeat task.wait() until Player.Character ~= nil
local Character = Player.Character

local Torque = Instance.new("Torque", Character:FindFirstChild("HumanoidRootPart")) -- Make torque, totally very important information
Torque.RelativeTo = Enum.ActuatorRelativeTo.Attachment0 -- I don't even know what the heck this thing does
Torque.Torque = Vector3.new(0,0,1200) -- Torque's strength and the direction of the "Torque" 

local Attachment0 = Instance.new("Attachment", Character:FindFirstChild("HumanoidRootPart"))
Attachment0.CFrame = CFrame.new(Character:FindFirstChild("HumanoidRootPart").CFrame.UpVector + Vector3.new(0,Character:FindFirstChild("HumanoidRootPart").Size.Y/2,0)) * CFrame.Angles(math.rad(90),0,0) -- Make the attachment go on top of the HumanoidRootPart

Torque.Attachment0 = Attachment0

Hope this help you.

And for more information,

Sorry if I make some grammars mistakes.

Edited : Edit some texts so its make a little be more sense

1 Like

My script is not in StarterCharacter, but in a Tool. And by the way script still does not work.

Do you need the player to spin when the player equipped the tool?

Yes. I use Equipped event and Unequipped to destroy Torque and Attachment.

Okay, and also please note that if you move while the torque rotating the HumanoidRootPart, it will not rotate.

And here is the script :

-- Parent it on your desired tool

local Tool = script.Parent

Tool.Equipped:Connect(function()
	if game.Players:GetPlayerFromCharacter(Tool.Parent) == nil then return end -- This is totally very important
	
	local Character = Tool.Parent -- Get the character, pretty sure you know this already
	local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
	
	local Torque, Attachment = Instance.new("Torque", HumanoidRootPart), Instance.new("Attachment", HumanoidRootPart) -- Make torque and attachment. And then, parent them both to HumanoidRootPart
	Attachment.CFrame = CFrame.new(HumanoidRootPart.CFrame.UpVector + Vector3.new(0,HumanoidRootPart.Size.Y/2,0)) * CFrame.Angles(math.rad(90),0,0) -- Make the attachment go on top of the HumanoidRootPart
	Attachment.Name = "OnTopOfTheHumanoidRootPart"
	
	Torque.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
	Torque.Torque = Vector3.new(0,0,500) -- The torque's strength and direction of the "torque"
	Torque.Attachment0 = Attachment
	Torque.Name = "MakeCharacterSpin"
end)

Tool.Unequipped:Connect(function()
	if game.Players:GetPlayerFromCharacter(Tool.Parent) == nil then return end -- This is totally very important
	
	local Character = Tool.Parent -- Get the character, again, I am pretty sure you know this already
	local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
	
	local Torque, Attachment = HumanoidRootPart:FindFirstChild("MakeCharacterSpin"), HumanoidRootPart:FindFirstChild("OnTopOfTheHumanoidRootPart")
end)

Then there is no point. I want for character to rotate and be able to move at the same time.

Yeah, there is really no point when the torque cancel it’s rotation when the character move.

Then how can I rotate character constantly?

I think you can use BodyGyro, but it was deprecated some time ago.

I’ve thinking about using TweenService, BUT it will mostly not work due to the player want their character can move. ( Haven’t tested on using TweenService. )

I can try using AngularVelocity. Though it doesn’t make object rotate constantly, I will try to get around that. I will post results here once I am done.

I can try using AngularVelocity . Though it doesn’t make object rotate constantly, I will try to get around that. I will post results here once I am done.

I have heard of it, it’s basically the newer version of BodyGyro I think.

I have come here to inform you, the AngularVelocity have the same problem as Torque.
Basically it just cancel the rotation when the character move.

My next suggestion is CFrames then.

Yeah I think that is the only way, other than using BodyGyro.

Honestly I kinda understand CFrame a little bit.

Okay, so I’m using lerp right now, it does spin but I can’t move my character. So more work for me

None of CFrames allow to move character. So I guess back to constraints. I am trying AlignOrientation now.

Okay, and I going to work on the “spinning using lerp” one.