serverscript:
local events = game.ReplicatedStorage:WaitForChild("RemoteEvents")

-- Store a reference to the active collars
local activeCollars = {}

local function GiveCollarGetAttachment(player)
	local char = player.Character
	local g = script.Collar:Clone()
	g.Parent = char

	local C = g:GetChildren()
	for i = 1, #C do
		if C[i]:IsA("BasePart") then
			local W = Instance.new("Weld")
			W.Part0 = g.Middle
			W.Part1 = C[i]
			local CJ = CFrame.new(g.Middle.Position)
			local C0 = g.Middle.CFrame:Inverse() * CJ
			local C1 = C[i].CFrame:Inverse() * CJ
			W.C0 = C0
			W.C1 = C1
			W.Parent = g.Middle
		end
	end

	local Y = Instance.new("Weld")
	Y.Part0 = char.Head
	Y.Part1 = g.Middle
	Y.C0 = CFrame.new(0, 0, 0)
	Y.Parent = Y.Part0

	local h = g:GetChildren()
	for i = 1, #h do
		if h[i]:IsA("BasePart") then
			h[i].Anchored = false
			h[i].CanCollide = false
		end
	end

	return g.AttachmentPart.Attachment
end

local function AddAttachmentToArm(player)
	local char = player.Character
	local newAttachment = Instance.new("Attachment")
	newAttachment.Position = Vector3.new(0, -1, 0)
	newAttachment.Parent = char["Right Arm"]

	return newAttachment
end

local function MakeLeash(Attachment0, Attachment1)
	local newRopeRenderer = script.RopeRenderer:Clone()
	newRopeRenderer.DrawLocalLine.Attachment0.Value = Attachment0
	newRopeRenderer.DrawLocalLine.Attachment1.Value = Attachment1
	newRopeRenderer.DrawLocalLine.RemoveEvent.Value = newRopeRenderer.RemoveCollar
	newRopeRenderer.Parent = workspace
	newRopeRenderer.Disabled = false

	return newRopeRenderer
end

local function AddPlayerController(victim, owner, removeEvent)
	local newPlayerController = script.PlayerController:Clone()
	newPlayerController.Owner.Value = owner.Character
	newPlayerController.RemoveEvent.Value = removeEvent
	newPlayerController.Parent = victim.PlayerGui
	newPlayerController.Disabled = false

	-- Ensure the correct reference is returned
	return newPlayerController
end

local function AddCollarRemover(victim, owner, removeEvent)
	local newRemover = script.CollarRemover:Clone()
	newRemover.RemoveEvent.Value = removeEvent
	newRemover.Victim.Value = victim
	newRemover.Owner.Value = owner
	newRemover.Parent = workspace
	newRemover.Disabled = false

	-- Ensure the correct reference is returned
	return newRemover
end


local function RemoveCollar(victim, remover)
	print("Removing collar for victim:", victim.Name, "by remover:", remover.Name)
	if activeCollars[victim] then
		local collarData = activeCollars[victim]

		-- Debugging: Check components before removal
		print("Removing collar for:", victim.Name)
		print("Rope exists:", collarData.rope and collarData.rope.Parent)
		print("Controller exists:", collarData.controller and collarData.controller.Parent)
		print("Remover exists:", collarData.remover and collarData.remover.Parent)

		-- Ensure each component exists before trying to destroy it
		if collarData.rope and collarData.rope.Parent then
			print("Destroying rope...")
			collarData.rope:Destroy()
		end

		if collarData.controller and collarData.controller.Parent then
			print("Destroying controller...")
			collarData.controller:Destroy()
		end

		if collarData.remover and collarData.remover.Parent then
			print("Destroying remover...")
			collarData.remover:Destroy()
		end

		-- Remove all "LineSegments" parts from the character
		for _, part in pairs(victim.Character:GetChildren()) do
			if part:IsA("BasePart") and part.Name == "LineSegments" then
				print("Destroying line segment part...")
				part:Destroy()
			end
		end

		-- Remove the collar model from the player's character
		local collarModel = victim.Character:FindFirstChild("Collar")
		if collarModel then
			print("Destroying collar model...")
			collarModel:Destroy()
		end

		-- Remove the reference from the activeCollars table
		activeCollars[victim] = nil
		print("Collar removed successfully!")

		-- Notify both players to update their UI
		events.UpdateCollarButton:FireClient(remover, "Request Collar")
		events.UpdateCollarButton:FireClient(victim, "Request Collar")
	else
		print("No collar found for:", victim.Name)
	end
end



events.RemoveCollar.OnServerEvent:Connect(function(player, target)
	if target then
		print("RemoveCollar event received for:", target.Name)  -- Debug print
		RemoveCollar(target, player)  -- target should be the victim, player should be the owner/remover
	else
		print("No valid target received in RemoveCollar event")  -- Debug print
	end
end)








local function MakeCollar(owner, victim)
	print("Creating collar: Owner:", owner.Name, "Victim:", victim.Name)
	local attachment0 = GiveCollarGetAttachment(victim)
	local attachment1 = AddAttachmentToArm(owner)
	local newRope = MakeLeash(attachment0, attachment1)

	-- Adding components to the player
	local newController = AddPlayerController(victim, owner, newRope.RemoveCollar)
	local newRemover = AddCollarRemover(victim, owner, newRope.RemoveCollar)

	-- Ensure that all components are correctly added
	activeCollars[victim] = {
		rope = newRope,
		controller = newController,
		remover = newRemover
	}

	-- Debug prints
	print("Collar created for:", victim.Name)
	print("activeCollars table:", activeCollars)

	-- Notify both players to update their UI
	events.UpdateCollarButton:FireClient(owner, "Remove Collar")
	events.UpdateCollarButton:FireClient(victim, "Remove Collar")
end




events.SendCollarRequest.OnServerEvent:Connect(function(player, target)
	events.ActivateLocalCollarUI:FireClient(target, player.Name)
end)

events.CollarPlayer.OnServerEvent:Connect(function(victim, owner)
	MakeCollar(owner, victim)
end)



localscript:
local Player = game.Players.LocalPlayer
local pgui = Player.PlayerGui

local mouse = Player:GetMouse()
local target = nil

local UI = script.Parent
local Main = UI.Frame
local intmenu = Main.OptionStuff
local cam = workspace.CurrentCamera

function HideUI()
	Main.TitleLabel.Text = ""
	Main.Visible = false
end

function button1Down()
	if not mouse.Target then
		target = nil
		HideUI()
	else
		if mouse.Target.Parent:FindFirstChild("Humanoid")
			and mouse.Target.Parent:FindFirstChild("HumanoidRootPart") then
			if game.Players:FindFirstChild(mouse.Target.Parent.Name) then
				target = mouse.Target.Parent:FindFirstChild("HumanoidRootPart")
				Main.TitleLabel.Text = mouse.Target.Parent.Name .. " Sync Menu:"
				intmenu.PlayerName.Value = mouse.Target.Parent.Name
			else
				target = nil
				HideUI()
			end
		else
			target = nil
			HideUI()
		end
	end	
end

mouse.Button1Down:Connect(button1Down)

function findPlayer(name)
	for _, player in pairs(game.Players:GetPlayers()) do
		if string.lower(player.Name) == string.lower(name) then
			return player
		end
	end
	return nil
end


intmenu.Button1.MouseButton1Click:Connect(function()
	local a = findPlayer(intmenu.PlayerName.Value)
	if a and a ~= game.Players.LocalPlayer then
		if pgui:FindFirstChild("Syncs") then
			if pgui.Syncs:FindFirstChild(a.Name) then
				game.ReplicatedStorage.RemoteEvents.RemoveSync:FireServer(a)
			else
				game.ReplicatedStorage.RemoteEvents.SendSyncRequest:FireServer(a)
			end
		end
	end
end)

intmenu.Button2.MouseButton1Click:Connect(function()
	local target = findPlayer(intmenu.PlayerName.Value)
	if target then
		if intmenu.Button2.Text == "Request Collar" then
			game.ReplicatedStorage.RemoteEvents.SendCollarRequest:FireServer(target)
		elseif intmenu.Button2.Text == "Remove Collar" then
			print("Attempting to remove collar from:", target.Name)
			game.ReplicatedStorage.RemoteEvents.RemoveCollar:FireServer(target)
		end
	end
end)



game["Run Service"].Stepped:Connect(function()
	if target ~= nil then
		local vector, onScreen = cam:WorldToScreenPoint(target.Position)
		local screenPoint = Vector2.new(vector.X, vector.Y)
		local depth = vector.Z

		intmenu.Button1.Text = "Request Sync"
		intmenu.Button1.TextColor3 = Color3.fromRGB(162, 255, 162)

		if pgui:FindFirstChild("Syncs") then
			if pgui.Syncs:FindFirstChild(intmenu.PlayerName.Value) then
				intmenu.Button1.Text = "Un-Sync"
				intmenu.Button1.TextColor3 = Color3.fromRGB(255, 162, 162)
			end
		end 

		Main.Position = UDim2.new(0, screenPoint.X, 0, screenPoint.Y)
		if onScreen then
			Main.Visible = true
		else
			Main.Visible = false
		end
	else
		HideUI()
	end
end)

game.ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("ActivateLocalSyncUI").OnClientEvent:Connect(function(a)
	local newsync = script.Parent.SyncNotif:Clone()
	newsync.PlayerName.Value = a
	newsync.TextLabel.Text = a .. " would like to sync."
	newsync.Visible = true
	print("this works properly?")
	newsync.Parent = UI.Frame1
end)

game.ReplicatedStorage.RemoteEvents.UpdateCollarButton.OnClientEvent:Connect(function(newText)
	intmenu.Button2.Text = newText
	if newText == "Remove Collar" then
		intmenu.Button2.TextColor3 = Color3.fromRGB(255, 0, 0) -- Red color
	else
		intmenu.Button2.TextColor3 = Color3.fromRGB(255, 255, 255) -- White color
	end
end)

output on the server:
  23:32:24.905  Creating collar: Owner: Player1 Victim: Player2  -  Server - CollarHandler:160
  23:32:24.908  Collar created for: Player2  -  Server - CollarHandler:177
  23:32:24.908  activeCollars table:  ▼  {
                    [Instance(Player2,1CA700D04C8)] =  ▶ {...}
                 }  -  Server - CollarHandler:178
  23:32:25.840  RemoveCollar event received for: Player1  -  Server - CollarHandler:145
  23:32:25.841  Removing collar for victim: Player1 by remover: Player2  -  Server - CollarHandler:88
  23:32:25.841  No collar found for: Player1  -  Server - CollarHandler:137


the collar won't get removed if the person that got collared is sending the request. it only sends if the person that sent the inital collar request wants to remove the collar.