Hello
I would like to tween rotate a sphere, having initial rotation = (0,0,25) around its local Y axis indefinitely.
Is there a way to do this using a goal, which I can set in advance?
Or I will need to tween some numerical value and change the sphere cframe manually when “changed” event of the numerical value is triggerred? (which I guess will be much more unefficient…)
If something is spinning at a linear speed forever on one axis I would suggest using RimServoce.RenderStepped (client) or HeartBeat (Server).
Option 1 (Recommended):
--[[ Local Script ]]--
local RunService = game:GetService("RunService")
local part = game.Workspace.Part
local speed = 5
RunService.RenderStepped:Connect(function(dt)
part.CFrame *= CFrame.Angles(0, speed * dt, 0)
end)
Option 2:
--[[ Server Script ]]--
local RunService = game:GetService("RunService")
local part = game.Workspace.Part
local speed = 5
RunService.HeartBeat:Connect(function(dt)
part.CFrame *= CFrame.Angles(0, speed * dt, 0)
end)