Greetings!
I’m working on a game with portals that can face the point the player is looking. These portals have weapons in them that launch them out. However when I do change their angle, the rotation tween breaks it.
local TweenService = game:GetService("TweenService")
local function TweenNew(Object,Time, Value)
local tween = TweenService:Create(Object, TweenInfo.new(Time, Enum.EasingStyle.Linear, Enum.EasingDirection.In,-1), {Orientation = Value})
tween:Play()
end
TweenNew(script.Parent,10, Vector3.new(360, script.Parent.Orientation.Y, script.Parent.Orientation.Z))
I tried using CFrame to do it but the rotation doesn’t complete. It stops about 45 degrees in.
local function TweenNew(Object, Time, Value)
local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = Object.CFrame
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
Object.CFrame = CFrameValue.Value
end)
local tween = TweenService:Create(CFrameValue, TweenInfo.new(Time, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1), {Value = Value})
tween:Play()
tween.Completed:Connect(function()
CFrameValue:Destroy()
end)
end
TweenNew(script.Parent,5, script.parent.CFrame * CFrame.fromEulerAnglesXYZ(360, 0, 0))
I’m not very good at explaining things, so if theres any questions I’ll try to explain what I can. Thanks in advance.