local U=script.Parent local f=nil local j=nil function SetMouseIcon(U,f)if U==nil then return end U.Icon=f==true and"\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\067\117\114\115\111\114\046\112\110\103"or"\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\087\097\105\116\067\117\114\115\111\114\046\112\110\103"end function onEquippedLocal(M)if M==nil then print("\077\111\117\115\101 \110\111\116 \102\111\117\110\100")return end f=U.Parent:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")j=U.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")if f==nil or j==nil then return end SetMouseIcon(M,U.IsEnabled.Value)U.IsEnabled.Changed:connect(function(U)SetMouseIcon(M,U)end)M.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\067\117\114\115\111\114\046\112\110\103"M.Button1Down:connect(function()script.Parent.MouseClick:FireServer(M.Hit.p)end)M.KeyDown:connect(function(U)script.Parent.KeyPress:FireServer(U)end)end U.Equipped:connect(onEquippedLocal)


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)
