hi so for my game i wanna make smth that basically whenu touch it u start spinning.
local humanoid = script.Parent
local humanoidRootPart = humanoid.Parent:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
coroutine.wrap(function()
while true do
wait(0.1)
humanoidRootPart.CFrame = humanoidRootPart.CFrame * CFrame.Angles(0, math.rad(15), 0) -- Rotate visually on Y-axis
end
end)()
else
warn("HumanoidRootPart not found!")
end
however it literally just makes u stay in place and when u move it bugs your camera
plz help
hi i found the solution to my own problem, if anyone were to have the same problem then:
use angularbodyvelocity
this script is placed in the humanoid
local humanoid = script.Parent -- Assuming the script is inside the Humanoid
local humanoidRootPart = humanoid.Parent:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
local bodyAngularVelocity = Instance.new("BodyAngularVelocity")
bodyAngularVelocity.AngularVelocity = Vector3.new(0, 10, 0) -- Spin on the Y-axis (adjust speed as needed)
bodyAngularVelocity.MaxTorque = Vector3.new(0, math.huge, 0) -- Apply unlimited torque on Y-axis
bodyAngularVelocity.Parent = humanoidRootPart
else
warn("HumanoidRootPart not found!")
end