So i am trying to make a gun the moves with the camera. I also want the guns to have a slight offset similar to this:
https://gyazo.com/f1a8cdf3bf79802001bfcd496dab0513
I want a slight offset only for the rotation but the position. I have tried everything and i have NO idea how.
function TweenRotation()
local Part1 = Panel.PrimaryPart
local TweenService = game:GetService("TweenService")
local x, y, z = Camera.CFrame:toEulerAnglesXYZ()
local PanelSwingInfo = TweenInfo.new(0.1) -- Let's use all defaults here
local PanelSwingTween = TweenService:Create(PanelRoot, PanelSwingInfo, {
--CFrame = CFrame.Angles(x, y, z)
CFrame = CFrame.new(PanelRoot.Position) * CFrame.Angles(x, y, z)
--CFrame = Camera.CFrame
})
PanelSwingTween:Play()
end
game:GetService("RunService").RenderStepped:Connect(function()
PanelRoot.CFrame = Camera.CFrame:ToWorldSpace()
if num == 4 then
TweenRotation()
num = 0
end
num = num + 1
end)