Tool=script.Parent Handle=Tool:WaitForChild("\072\097\110\100\108\101")Players=game:GetService("\080\108\097\121\101\114\115")RunService=game:GetService("\082\117\110\083\101\114\118\105\099\101")ServerControl=Tool:WaitForChild("\083\101\114\118\101\114\067\111\110\116\114\111\108")ClientControl=Tool:WaitForChild("\067\108\105\101\110\116\067\111\110\116\114\111\108")ToolEquipped=false function CheckIfAlive()return(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and(Humanoid.Health>0 and(Player and Player.Parent))))))and true or false end function Equipped(u)Character=Tool.Parent Player=Players:GetPlayerFromCharacter(Character)Humanoid=Character:FindFirstChild("\072\117\109\097\110\111\105\100")if not CheckIfAlive()then return end PlayerMouse=Player:GetMouse()ToolEquipped=true end function Unequipped()ToolEquipped=false end function InvokeServer(u,v)local o pcall(function()o=ServerControl:InvokeServer(u,v)end)return o end function OnClientInvoke(u,v)if not ToolEquipped or not CheckIfAlive()or not u then return end if u=="\077\111\117\115\101\068\097\116\097"then return{Position=PlayerMouse.Hit.p;Target=PlayerMouse.Target}end end ClientControl.OnClientInvoke=OnClientInvoke Tool.Equipped:connect(Equipped)Tool.Unequipped:connect(Unequipped)


Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")
RunService = game:GetService("RunService")

ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")

ToolEquipped = false

function CheckIfAlive()
	return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	if not CheckIfAlive() then
		return
	end
	PlayerMouse = Player:GetMouse()
	ToolEquipped = true
end

function Unequipped()
	ToolEquipped = false
end

function InvokeServer(mode, value)
	local ServerReturn
	pcall(function()
		ServerReturn = ServerControl:InvokeServer(mode, value)
	end)
	return ServerReturn
end

function OnClientInvoke(mode, value)
	if not ToolEquipped or not CheckIfAlive() or not mode then
		return
	end
	if mode == "MouseData" then
		return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
	end
end

ClientControl.OnClientInvoke = OnClientInvoke
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
