-------------------------------


local tool = script.Parent
local player = game.Players.LocalPlayer
while player.Character == nil do wait() end
local char = player.Character
while char:FindFirstChild("Humanoid") == nil do wait() end
local hum = char:FindFirstChild("Humanoid")

local enabled = true
local equipped = false
local ischarging = true
tool.Selected:connect(function(mouse)
	equipped = true
	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function()
		if not enabled then return end
		if hum == nil then return end
		if hum.Health <= 0 then return end
		if mouse == nil then return end
		if ischarging then
			if mouse.Hit ~= nil then
				ischarging = false
				enabled = false
				script.Parent.ReleaseProjectile:FireServer(mouse.Hit.p)
				mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
				wait(RELOAD_TIME)
				mouse.Icon = "rbxasset://textures\\GunCursor.png"
				enabled = true
				ischarging = true
			end
		end
	end)
end)

tool.Deselected:connect(function(mouse)
	equipped = false
end)


