This is turning the cannon towards the humanoid instantly, but how to make the same turn only slowly?
This is instantly:
cannon.Muzzle.CFrame = CFrame.lookAt(cannon.Muzzle.Position, nearDummyHRP.Position)
This is turning the cannon towards the humanoid instantly, but how to make the same turn only slowly?
This is instantly:
cannon.Muzzle.CFrame = CFrame.lookAt(cannon.Muzzle.Position, nearDummyHRP.Position)
Use Tween Service.
local tws = game:GetService("TweenService")
local twi = TweenInfo.new(
1, -- Time
Enum.EasingStyle.Sine -- Style
Enum.EasingDirection.InOut -- Direction
)
tws:Create(cannon.Muzzle,twi,{CFrame = CFrame.lookAt(cannon.Muzzle.Position, nearDummyHRP.Position)}):Play() -- Play the tween.
try using wait() when delaying or slowing functions.