Gun's Aim Down Sights doesn't work when cloned

  1. What do you want to achieve? Keep it simple and clear!
    I want to fix the problem with my gun’s cloning system
  2. What is the issue? Include screenshots / videos if possible!
    The gun only works when it is put in StarterPack and given to the player, but when it is duplicated, it glitches for some reason, and my sights don’t work on the gun.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have already tried changing the cloning system in the serverscript

Main part of ADS script:

	local ts = game:GetService("TweenService")
	local cam = workspace.CurrentCamera
	local aimPart = script.Parent.Parent:WaitForChild("AimPart")
	local Time = 0.15 
	local function calculateSine(speed)
		sinValue += speed * 0.6
		if sinValue > (math.pi * 2) then sinValue = 0 end
		local sineY = 0.01 * math.sin(2 * sinValue)
		local sineZ = 0.01 * math.sin(sinValue)
		local sineCFrame =, sineY, 0)
		return sineCFrame
	if not zooming and player.PlayerScripts.Sprint.Value == false then
		local sineCFrame = calculateSine(0.04)
		if resetArm == false then
		resetArm = true
		aimPart.CFrame = (cam.CFrame * restPosition * sineCFrame):lerp(cam.CFrame * aimPosition, lerpd)
		ts:Create(cam,, {FieldOfView = 80}):Play()
		player.PlayerScripts.Zoom.Value = false
	elseif zooming and player.PlayerScripts.Sprint.Value == false and player.PlayerScripts.Crouching.Value == false then
		player.PlayerScripts.Zoom.Value = true
		ts:Create(cam,, {FieldOfView = 30}):Play()
		resetArm = false
		local sineCFrame = calculateSine(0.02)
		aimPart.CFrame = (cam.CFrame * restPosition):lerp(cam.CFrame * aimPosition * sineCFrame, lerpd)