for the viemodel in my game (a clone of the player), i usually have it copying the player's serverside animations, just while following the camera. but for aiming i have the viewmodel at a set position with the weapon's front sight relative to the camera. the problem here is it just teleports to that position which is not ideal, so i tried setting up a tween but it doesn't work.

viewmodel tweening code (entirely clientside):

local tweenInfo = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.InOut,
	1,
	false,
	0
)
local goal = {CFrame = CFrame.new(camera()*Vector3.new(0, 0, -3), camera()*Vector3.new(0, 0, -4));}
local tween = tweenService:Create(viewTool.frontSight, tweenInfo, goal)

runService.RenderStepped:Connect(function()
	viewModel.Head.CFrame = camera()
	if ADS == true then
		viewTool.frontSight.CFrame = CFrame.new(camera()*Vector3.new(0, 0, -3), camera()*Vector3.new(0, 0, -4))
	end
end)
game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent)
	if tool.Parent == character then
             if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
			game.ReplicatedStorage.weaponFunctions.startAimEvent:FireServer()
			tween:Play()
			wait(0.5)
			ADS = true
		end

	end
end)

1 comment

0

i basically snipped out only the part of the script responsible for the tween, so it probably won't run as-is