Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you constantly spin a players character?

Hello,

Context - I am trying to make a !spin player command for my game. I have removed the internal command system code from this question for simplicity.

Problem: - The player doesn't spin correctly. Using multiple methods to spin the player, I cannot get the player to spin.

Attempt 1: - My first method was using CFrame, with this code being run for the HumanoidRootPart:

hum.HumanoidRootPart.CFrame = hum.HumanoidRootPart.CFrame * CFrame.fromEulerAnglesXYZ(0,-0.1,0,0)

This code spins the player. However, the player is stuck in a fixed position (the player cannot move while spinning).

Attempt 2: - The second method was using a BodyGyro. I used the following code to create the BodyGyro and to customise it for spinning the character:

local BodyGyro = Instance.new('BodyGyro', hum.FindFirstChild("HumanoidRootPart")) 
BodyGyro.P = 10000
BodyGyro.D = 1000
BodyGyro.MaxTorque.Y = 300

while true do
	BodyGyro.CFrame = CFrame.new(0,90,0)
	wait(0.15)
	BodyGyro.CFrame = CFrame.new(0,180,0)
	wait(0.15)
	BodyGyro.CFrame = CFrame.new(0,270,0)
	wait(0.15)
	BodyGyro.CFrame = CFrame.new(0,360,0)
	wait(0.15)
end

This spins the character away from the camera. Then stops spinning. I tried to fix this problem by adding a change in CFrame every 0.15 seconds, as shown in the code above. This does not fix the issue.

I do not know how to solve this problem. Any advice or solutions you have would be appreciated.

Tweakified

1 answer

✓ Accepted answer

Using BodyAngularVelocity!

local BodyAngularVelocity = Instance.new('BodyAngularVelocity', hum:FindFirstChild("HumanoidRootPart"))
BodyAngularVelocity.AngularVelocity = Vector3.new(0,10,0)             --Change Speed(10) Here!

This discussion is preserved as it was. New answers, comments, and votes are closed.