I am trying to make a part that spins continuously through tweening. However, the CFrame.Angles()
is affecting the position as well. (Its at the end) Here is what it looks like
Here is my code:
local TweenService = game:GetService("TweenService")
local Coin = script.Parent
local tweenInfo = TweenInfo.new(
5,
Enum.EasingStyle.Circular,
Enum.EasingDirection.InOut,
0,
false,
0
)
while true do
local offsetCFrame = CFrame.new(0, 0, 0)
local rotatedCFrame = CFrame.Angles(0, math.rad(180), 0)
offsetCFrame = offsetCFrame:ToWorldSpace(rotatedCFrame)
local newCFrame = Coin.CFrame:ToWorldSpace(offsetCFrame)
local tweenCoin = TweenService:Create(Coin, tweenInfo, {CFrame = newCFrame})
tweenCoin:Play()
wait(5)
end
Any help is appreciate!
I was unable to see your example
Its asking me to request access
looking at this example within - CFrames | Roblox Creator Documentation
What your currently doing with the multiple Cframe variables seems to be more than whats actually needed.
while true do
local newCFrame = CFrame.Angles(0, math.rad(180), 0)
local tweenCoin = TweenService:Create(Coin, tweenInfo, {CFrame = newCFrame})
tweenCoin:Play()
wait(5)
end
You shouldnt be using TweenService to rotate the part. Use a Hinge or a BodyAngularVelocity.
Still isn’t working
You can now watch the video though
It is working now. All I had to do is change the orientation. Here is the code:
local TweenService = game:GetService("TweenService")
local Coin = script.Parent
local tweenInfo = TweenInfo.new(
5,
Enum.EasingStyle.Circular,
Enum.EasingDirection.InOut,
0,
false,
0
)
while true do
local tween1 = TweenService:Create(Coin, tweenInfo, {Orientation = Vector3.new(0, 180, 0)})
tween1:Play()
wait(6)
local tween2 = TweenService:Create(Coin, tweenInfo, {Orientation = Vector3.new(0, 0, 0)})
tween2:Play()
end