Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Any way at all to fix this equip bug? I have no idea what to do.

Asked by 5 years ago

So with the FE gun kit, im trying to do some modification for one of my friends, and realized that there is a huge bug in this kit, if you equip it, and then instantly unequip it, you can click and it will fire, have bullet drop, etc. Anyone help? Heres the equip part of the script.

Tool.Equipped:connect(function(TempMouse)
    GUI.Parent = Player.PlayerGui
    UpdateGUI()
    Handle.EquippedSound:Play()
    if Module.WalkSpeedRedutionEnabled then
    Humanoid.WalkSpeed = Humanoid.WalkSpeed - Module.WalkSpeedRedution
    else
    Humanoid.WalkSpeed = Humanoid.WalkSpeed
    end
    CrosshairModule:setcrosssettings(Module.CrossSize, Module.CrossSpeed, Module.CrossDamper)
    UserInputService.MouseIconEnabled = false
    if EquippedAnim then EquippedAnim:Play(nil,nil,Module.EquippedAnimationSpeed) end
    if IdleAnim then IdleAnim:Play(nil,nil,Module.IdleAnimationSpeed) end
    game.ReplicatedStorage.PullOut:FireServer()
    delay(Module.EquippingTime, function()
        Equipped = true
        if Module.AmmoPerMag ~= math.huge then GUI.Frame.Visible = true end
    end)
    TempMouse.KeyDown:connect(function(Key)
        if string.lower(Key) == "r" then
            Reload()
        elseif string.lower(Key) == "g" then
            if not Reloading and not HoldDown and Module.HoldDownEnabled then
                HoldDown = true
                IdleAnim:Stop()
                if HoldDownAnim then HoldDownAnim:Play(nil,nil,Module.HoldDownAnimationSpeed) end
                if AimDown then 
                    TweeningService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
                    CrosshairModule:setcrossscale(1)
                    --[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
                    if GUI then GUI:Destroy() end]]
                    Scoping = false
                    game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.Classic
                    UserInputService.MouseDeltaSensitivity = InitialSensitivity
                    AimDown = false
                end
            else
                HoldDown = false
                IdleAnim:Play(nil,nil,Module.IdleAnimationSpeed)
                if HoldDownAnim then HoldDownAnim:Stop() end
            end
        end
    end)

Here is the unequip part of the script.

Tool.Unequipped:connect(function()
    game.ReplicatedStorage.PutBack:FireServer()
    HoldDown = false
    Equipped = false
    GUI.Parent = script
    GUI.Frame.Visible = false
    if Module.WalkSpeedRedutionEnabled then
    Humanoid.WalkSpeed = Humanoid.WalkSpeed + Module.WalkSpeedRedution
    else
    Humanoid.WalkSpeed = Humanoid.WalkSpeed
    end
    UserInputService.MouseIconEnabled = true
    if IdleAnim then IdleAnim:Stop() end
    if HoldDownAnim then HoldDownAnim:Stop() end
        if AimDown then
            TweeningService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
            CrosshairModule:setcrossscale(1)
            --[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
            if GUI then GUI:Destroy() end]]
            Scoping = false
            game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.Classic
            UserInputService.MouseDeltaSensitivity = InitialSensitivity
            AimDown = false
        end
    if Module.DualEnabled and not workspace.FilteringEnabled then
        Handle2.CanCollide = true
        if Grip2 then Grip2:Destroy() end
    end
end)

Answer this question