So I made a script where the object spins, but it spins way to fast, is there anyway I can reduce the amount of speed it gives?
This is the script:
wait()
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(1, 0, 0)
end```
So I made a script where the object spins, but it spins way to fast, is there anyway I can reduce the amount of speed it gives?
This is the script:
wait()
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(1, 0, 0)
end```
wait()
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0.1, 0, 0)
end
Change 1 to 0.1.
Thank you so very much!
(30 chaar)
Nevermind, they don’t spin at all now.
You should probably spin an object using math.pi and for loops. Using it, you can adjust the increment. If the increment is higher, it goes faster.
local defaultCFrame = script.Parent.CFrame -- // So we have the original rotation.
for i = 0, math.pi*2, 0.01 do -- // Adjusting the 0.01 to be a smaller number will slow down the speed.
script.Parent.CFrame = defaultCFrame * CFrame.Angles(i, 0, 0)
Heartbeat:Wait() -- // Make sure to define RunService.Heartbeat.
end
They still don not spin.
(30 chaar)
If this is a server script, try heartbeat instead.
It’s a regular script within a mesh.
You can use math.rad()
to convert the degrees to radians, if that helps. Radians are more accurate with rotating things, for example, if you wanted to rotate a part precisely 90 degrees, you would use math.rad(90)
. I don’t know about CFrame.Angles, but I mainly use fromEulerAnglesXYZ for rotating or spinning parts. If you want it to spin forever, you can do this in a while loop.
while true do
wait()
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(1),0,0)
end
To make it spin slower, change the 1 to a smaller number.
It should spin perfectly. I am using the same code:
Code:
local defaultCFrame = script.Parent.CFrame -- // So we have the original rotation.
for i = 0, math.pi*2, 0.01 do -- // Adjusting the 0.01 to be a smaller number will slow down the speed.
script.Parent.CFrame = defaultCFrame * CFrame.Angles(i, 0, 0)
game:GetService("RunService").Heartbeat:Wait() -- // Make sure to define RunService.RenderStepped.
end
It works now, thank you so much!