--[[

MIT License

]]


local Player = game.Players.LocalPlayer
local Mouse  = Player:GetMouse()
local Tool   = script.Parent
local Using  = false
local RemoteEvent = game.ReplicatedStorage.Events.Etc.Detain

Tool.Activated:Connect(function()
	if not Using then
		if Mouse.Target then
			if (Mouse.Target.Position-Player.Character.HumanoidRootPart.Position).Magnitude < 10 then 
			RemoteEvent:FireServer('Cuff', Mouse.Target)
			end
		end
	else 
		Using = false
		RemoteEvent:FireServer('UnCuff')
	end
end)
Tool.Unequipped:Connect(function()
if Using == true then
RemoteEvent:FireServer('UnCuff')
end
Using = false

end)
RemoteEvent.OnClientEvent:Connect(function( state )
wait(.5)
	if state == 'Use' then
		Using = true
	end
end)
