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

Why does aim script phase in and out of changing the FOV?

Asked by 5 years ago

Hi! I made an aim script for a raycast gun and for some unknown reason it randomly will phase in and out of aiming and sometimes not aim at all on certain guns. Some tools work, some don't.

Here is the localscript that handles all of it. (Mousebutton2 Up/Down and the while true are the important ones)

01local aiming = false
02local cc = game.Workspace.CurrentCamera
03function Equip(mouse)
04    local Player = game.Players.LocalPlayer
05    local AmmoGui = script.Parent.AmmoGUI:Clone()
06    idleAnim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Idle)
07    fireAnim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Fire)
08    AmmoGui.Parent = Player.PlayerGui
09    AmmoGui.TextLabel1.LocalScript.Disabled = false
10    AmmoGui.TextLabel2.LocalScript.Disabled = false
11    mouse.Icon = "rbxasset://textures/GunCursor.png"
12    idleAnim:Play()
13    mouse.Button1Down:connect(function()
14        print("Mouse pressed client!")
15        if script.Parent.Ammo.Value > 0 and script.Parent.IsReloading.Value == false and script.Parent.IsFiring.Value == false then
View all 71 lines...
0
UPDATE: Only breaks on one tool but as soon as I add 2 tools it breaks pengalu200 65 — 5y

Answer this question