Problem with cloning a gun with raycast keeps breaking

Hello Developers,
I have this gun where by when you buy the gun it clones the gun but the raycast inside it breaks any solutions in solving it
raycast script

local Tool = script.Parent
local Fire = Tool:WaitForChild("Fire")
local ReloadEvent = Tool.Reload
local Speed = 200
local Damage = 19
local Ammo = Tool:WaitForChild("Ammo")
local Reloading = false
local Cooldown = false

local function reload()
    if Reloading then return end
    Reloading = true
    wait(1.5)
    Ammo.Value = 15
    Reloading = false
end

local function fire(plr, MousePos)
    if Ammo.Value > 0 then
        if not Cooldown then
            Ammo.Value -= 1
            Cooldown = true

            local ARay = Instance.new("Part", workspace)
            ARay.Name = "Ray"
            ARay.Anchored = true
            ARay.Size = Vector3.new(.3,.3,300)
            ARay.CanCollide = false
            ARay.CFrame = CFrame.new(Tool.origin.Position, MousePos)
            ARay.Position = ARay.Position + ARay.CFrame.LookVector * 250
            ARay.Transparency = 1

            local raycastparam = RaycastParams.new()
            raycastparam.FilterDescendantsInstances = {plr.Character}
            raycastparam.FilterType = Enum.RaycastFilterType.Blacklist
            local result = workspace:Raycast(Tool.origin.Position,CFrame.new(Tool.origin.Position,MousePos).LookVector * Speed, raycastparam)
            if result then
                local part = result.Instance
                if part.Parent:FindFirstChild("Humanoid") then
                    part.Parent.Humanoid:TakeDamage(Damage)
                end
            end
            wait(.25)
            ARay:Destroy()
            wait(.2)
            Cooldown = false
        end
    else
        reload()
    end
end

Fire.OnServerEvent:Connect(fire)

ReloadEvent.OnServerEvent:Connect(reload)

any help is appreciated!!