--local Mouse = player:GetMouse()

local UserInputService = game:GetService("UserInputService")
local Event = Tool:WaitForChild("RemoteEvent")
local RunService = game:GetService("RunService")
local Equipped = false
local camera = workspace.CurrentCamera

Tool.Equipped:Connect(function()
	Equipped = true
end)

Tool.Activated:Connect(function()
	RunService.RenderStepped:Connect(function()
		if Equipped then
			local mouse = UserInputService:GetMouseLocation()
			local unitray = camera:ScreenPointToRay(mouse.X , mouse.Y)
			Event:FireServer(unitray)
		end
		wait()
	end)
end)

Tool.Unequipped:Connect(function()
	Equipped = false
end)
