Im trying to make a code that rotates a model by 360 with tween service, how do i make it?
First you need to make a primary part, and assign the models primary part to that part, then weld everything to that part, and tween the CFrame of the primary part by 360 Degrees with math.rad()
.
I don’t want to script everything for you, As this is an opportunity for you to learn, if your really struggling, ask for help.
i tried this and dont work
local TS = game:GetService("TweenService")
local pPart = script.Parent.PrimaryPart
local tween = TS:Create(pPart, TweenInfo.new(0.9, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1), {Orientation = Vector3.new(0,math.rad(360), 0)})
tween:Play()
Did you weld every part to the primary part?
Also your tweening Orientation, which don’t work on models, you have to tween the CFrame. Try something like this:
local tween = TS:Create(pPart, TweenInfo.new(0.9, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1), {CFrame = CFrame.new(0,math.rad(360), 0)})
still doesnt work. Now it is changing the part position. and i welded.
sorry, here try this:
local tween = game.TweenService:Create(script.Parent, TweenInfo.new(0.9, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1), {CFrame = script.Parent.CFrame*CFrame.Angles(0,360, 0)}):Play()
you typed “script.Parent”, it is the model, you cant assign CFrame, however by changing it to pPart it works.
sorry, I was just testing in studio, glad you fixed it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.