Hello, everyone.
My new aiming down sights system for my gun keeps flicking back and forth. i only have it in a loop since i have other things interacting with the ads such as walking, etc.
video of this happening
local function Aim()
local ViewModel = workspace.ViewModel :: Model
if not IsAiming then
local AimPart = ViewModel:FindFirstChild("AimPart",true)
IsAiming = true
local FieldOfView = workspace.Camera.FieldOfView
local Track2 = Tween:Create(workspace.Camera,AdsInfo,{FieldOfView = FieldOfView/1.5})
Track2:Play()
local Camera = workspace.Camera
repeat
local Offset = AimPart.CFrame:Inverse() * workspace.Camera.CFrame-- * ViewModel:GetAttribute("Walk"):Inverse()
local Track = Tween:Create(ViewModel.AimTween,AdsInfo,{Value = Offset})
Track:Play()
Track.Completed:Wait()
until not IsAiming
else
print("stopped")
IsAiming = false
local FieldOfView = workspace.Camera.FieldOfView
local Track = Tween:Create(ViewModel.AimTween,AdsInfo,{Value = CFrame.new()})
local Track2 = Tween:Create(workspace.Camera,AdsInfo,{FieldOfView = FieldOfView*1.5})
Track:Play()
Track2:Play()
end
end
So you need to animation happened once and it stoped at end?
to do it you need to use :Pause function when Track.Completed:Wait() and remove repeat untill loop
i just removed the repeat loop, but now im having another issue. my walk cframe is messing up my aiming down sight script. since the ads is calculating with the walk cframe. when i stop walking the sight is offsetted.
repeat
local Offset = AimPart.CFrame:Inverse() * workspace.Camera.CFrame-- * ViewModel:GetAttribute("Walk"):Inverse()
local Track = Tween:Create(ViewModel.AimTween,AdsInfo,{Value = Offset})
Track:Play()
Track.Completed:Wait()
until not IsAiming
you’re loop tweening the viewmodel based off the camera cframe until they stop aiming with the scope why do you need to loop it just tween it once then keep it locked like that
Just check the humanoid’s move direction and account for the camera sway. Also if u loop it and tween it while ur scope is in the middle based off the camera cframe it’s gonna tween it away.
ive seen this tutorial many times, and it lacks camera sway, or arm movement while walking. which are what is causing my issues. thanks for the help tho.
What does it mean “middle off the camera is gonna tween it away” i’ve tried it on a normal part and for some reason it behaves as expected, but only doesn’t when i do it on the viewmodel???
im calculating the offset, of the aimpart and the viewmodel. but that doesn’t explain why it’s going backwards.