-
What do you want to achieve? Keep it simple and clear!
I want to fix the problem with my gun’s cloning system -
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. -
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:
game:GetService("RunService").RenderStepped:Connect(function(dt)
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 = CFrame.new(sineZ, sineY, 0)
return sineCFrame
end
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, TweenInfo.new(0.2), {FieldOfView = 80}):Play()
player.PlayerScripts.Zoom.Value = false
end
elseif zooming and player.PlayerScripts.Sprint.Value == false and player.PlayerScripts.Crouching.Value == false then
player.PlayerScripts.Zoom.Value = true
ts:Create(cam, TweenInfo.new(Time), {FieldOfView = 30}):Play()
resetArm = false
local sineCFrame = calculateSine(0.02)
aimPart.CFrame = (cam.CFrame * restPosition):lerp(cam.CFrame * aimPosition * sineCFrame, lerpd)
end
end)