It's because you rotated the character directly at 360 degrees. To spin, you need to gradually increase the rotation until it reaches 360. You can achieve that using a for loop.
In case if you don't know what a for loop does, it has two types: for number = start, finish, increment do and for ... in function do.
The first one simply adds increment to number from start until number is equal to finish.
for number = 1, 10 do
print(number)
end
for odd = 1, 9, 2 do
print(odd)
end
for even = 2, 10, 2 do
print(even)
end
The second one is mostly used for tables. It gets the returned values from the function.
function test()
return "hi", "hello", "Roblox"
end
for a, b, c, d in test do
print(a, b, c, d)
end
The second one is mostly used for tables is because of the pairs() function. This guy explains better of what does pairs() do.
local tbl = {
[1] = "hi",
["hello"] = "Roblox"
}
for a, b in pairs(tbl) do
print(a, b)
end
Now that we know what is a for loop, we can now use it:
local characterCFrame = character:GetPivot()
for rotation = 1, 360 do
character:PivotTo(characterCFrame * CFrame.Angles(0, math.rad(rotation), 0))
task.wait()
end
character:PivotTo(characterCFrame)
4 comments
That was fantastic! Completely answered the question! If I could trouble you for one additional bit of help, is there a way to make the rotation go faster?
You can change the increment. For example, if I do
for rotation = 1, 360, 2 doit will spin 2x fasterPerfect! Everything is solved! Thank you so much!
You’re welcome! <3