--Edited by QS


local Tool = script.Parent;
local torso = nil
local human = nil

function SetMouseIcon(mouse,bool)
	if mouse == nil then return end
	mouse.Icon = bool == true and "rbxasset://textures\\GunCursor.png" or "rbxasset://textures\\GunWaitCursor.png"
end


function onEquippedLocal(mouse)
	if mouse == nil then
		print("Mouse not found")
		return 
	end

	torso = Tool.Parent:FindFirstChild("HumanoidRootPart")
	human = Tool.Parent:FindFirstChild("Humanoid")--getHumanoid(Tool.Parent)
	if torso == nil or human == nil then return end
	
	SetMouseIcon(mouse,Tool.IsEnabled.Value)
	Tool.IsEnabled.Changed:connect(function(bool)
		SetMouseIcon(mouse,bool)
	end)

	mouse.Icon = "rbxasset://textures\\GunCursor.png"
	mouse.Button1Down:connect(function() 
		script.Parent.MouseClick:FireServer(mouse.Hit.p)
	end)
	mouse.KeyDown:connect(function(key)
		script.Parent.KeyPress:FireServer(key)
	end)
end


Tool.Equipped:connect(onEquippedLocal)
