What steps would I need to take in order to make it so I can still freelook around during the tween,
Currently the tween gets the current position of the player and tweens it up by 15 studs,
However I have another function which makes the character look towards the mouse.hit, During the tween the character will no longer look at the mouse.hit, I suspect this is because of the way I’m getting the CFrameValue but I’m unsure how I can correct it, any ideas?
function GraviticFlux.activateUltimate(inputObj, isTyping)
if inputObj.KeyCode == Enum.KeyCode.X and not debounce then
debounce = true
rootPart.Anchored = true
GraviticFlux.LookAtMouse()
GraviticFlux.Tween(character, rootPart.CFrame * CFrame.new(0,15,0))
task.wait(5)
connection:Disconnect()
rootPart.Anchored = false
end
end
function GraviticFlux.LookAtMouse()
connection = RunService.RenderStepped:Connect(function(dt)
local rootPos, mousePos = rootPart.Position, mouse.Hit.Position
rootPart.CFrame = CFrame.new(rootPos, Vector3.new(mousePos.X, mousePos.Y, mousePos.Z))
end)
end
function GraviticFlux.Tween(model, CF)
local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = model:GetPrimaryPartCFrame()
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
model:SetPrimaryPartCFrame(CFrameValue.Value)
end)
local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = TweenService:Create(CFrameValue, tweenInfo, {Value = CF})
tween:Play()
tween.Completed:Connect(function()
CFrameValue:Destroy()
end)
end