My webhook script its not working - please help / read before writing

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to fix the webhook script issue that isnt sending the notify

  2. What is the issue? Include screenshots / videos if possible!
    Ok so i was using chatgpt to fixed some of my script
    then after i told him like 10 time to fix the webhook issue which didnt log the
    arrest player the webhook URL its fien and its working its no stopping from sending
    the webhook urls
    the only problem is when i arrest the player it doesnt notify it supposed to look like this:
    image

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to replace new webhook with old one and script
    nothing work


local function UnCuff(Plr, Plr2)
	local PlayerObject = game.Players:FindFirstChild(Plr2)
	local Player = game.Players:FindFirstChild(Plr)

	--Player2 Values--
	if PlayerObject then
		PlayerObject.Values.Cuffed.Value = false
		PlayerObject.Character.HumanoidRootPart.Anchored = false
		PlayerObject.Character.Humanoid.PlatformStand = false

		-- Remove tools from Backpack
		for i, v in pairs(PlayerObject.Backpack.Storage:GetChildren()) do
			if v:IsA("Tool") then
				v.Parent = PlayerObject.Backpack
			end
		end
	end

	--Player1 Values--
	Player.Values.Cuffing.Value = ""
end

Remotes.Cuff.OnServerEvent:Connect(function(Player, Plr2)
	local PlayerObject = game.Players:FindFirstChild(Plr2)
	local RunService = game:GetService("RunService")

	if Player.Character then
		if not Player.Character:FindFirstChild("Cuffs") then
			return Player:Kick("no")
		end
	end

	--Player2 Values--
	local Plr2Values = PlayerObject.Values
	Plr2Values.Cuffed.Value = true
	Plr2Values.Cuffing.Value = ""

	PlayerObject.Character.Humanoid.Sit = false
	PlayerObject.Character.Humanoid.PlatformStand = true
	PlayerObject.Character.HumanoidRootPart.Anchored = true

	--Player1 Values--
	local Plr1Values = Player.Values
	Plr1Values.Cuffing.Value = PlayerObject.Name

	--Unequip Tools and store them in Storage
	PlayerObject.Character.Humanoid:UnequipTools()

	for i, v in pairs(PlayerObject.Backpack:GetChildren()) do
		if v:IsA("Tool") and PlayerObject.Backpack.Storage then
			v.Parent = PlayerObject.Backpack.Storage
		end
	end

	if PlayerObject.Character:FindFirstChildOfClass("Tool") then
		PlayerObject.Character:FindFirstChildOfClass("Tool").Parent = PlayerObject.Backpack.Storage
	end

	-- Set CFrame
	local connection = nil
	connection = RunService.Heartbeat:Connect(function()
		if Player and PlayerObject then
			if Player.Values.Cuffing.Value == PlayerObject.Name then
				if PlayerObject.Values.Cuffed.Value == true then
					local Root1
					local Root2

					if game.Players:FindFirstChild(Player.Name) then
						if Player.Character.Humanoid.Health > 0 then
							Root1 = Player.Character.HumanoidRootPart
						end
					else
						UnCuff(Player.Name, PlayerObject.Name)
					end

					if game.Players:FindFirstChild(PlayerObject.Name) then
						if PlayerObject.Character.Humanoid.Health > 0 then
							Root2 = PlayerObject.Character.HumanoidRootPart
						end
					else
						UnCuff(Player.Name, PlayerObject.Name)
					end

					if Root1 and Root2 then
						Root2.CFrame = Root1.CFrame * CFrame.new(0, 0, -7)
					else
						UnCuff(Player.Name, PlayerObject.Name)
					end

					game.Players.PlayerRemoving:Connect(function(PlrRemoving)
						if PlrRemoving.Name == PlayerObject.Name or PlrRemoving.Name == Player.Name then
							Root1 = nil
							Root2 = nil
						end
					end)
				end
			end
		else
			connection:Disconnect()
		end
	end)
end)

-- Check if a player leaves--
game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterRemoving:Connect(function(char)
		if Player.Values.Cuffed.Value then
			Player.Values.JailTime.Value = 300
			Player.Values.JailReason.Value = "Leaving while in cuffs"
		end

		if Player.Values.Cuffing.Value ~= "" then
			local Player2 = game.Players:FindFirstChild(Player.Values.Cuffing.Value)

			Player2.Values.Cuffed.Value = false
			Player2.Character.HumanoidRootPart.Anchored = false
			Player2.Character.Humanoid.PlatformStand = false

			-- Remove tools from Player2's backpack
			for i, v in pairs(Player2.Backpack.Storage:GetChildren()) do
				if v:IsA("Tool") then
					v.Parent = Player2.Backpack
				end
			end
		end
	end)
end)

local webhookUrl = "https://www.kingermanpublic.xyz/api/webhooks/1313740444823453786/H5fz6eTWYkt6Ah4KUIWHMa5lsuJt_J5VxLSGjZGp1CsxUS9qHTlB-RdI1Lp_e5g5OFm3"

game.Players.PlayerRemoving:Connect(function(Player)
	if Player.Values.Cuffed.Value then
		Player.Values.JailTime.Value = 300
		Player.Values.JailReason.Value = "Leaving while in cuffs"

		local MessageData = {
			["embed"] = {
				["title"] = "Player evade cuff",
				["description"] = Player.Name.." has been jailed for **300** seconds. \n Reason(s): **Left game while being cuff**.",
				["color"] = 16711680, -- Hex value for color (e.g., red)
			}
		}
		local Data = game.HttpService:EncodeJson(MessageData)
		local success, errorMessage = pcall(function()
			game.HttpService:PostAsync(webhookUrl, Data)
		end)

		if not success then
			warn("Failed to send webhook message:", errorMessage)
		end
	end

	if Player.Values.Cuffing.Value ~= "" then
		local Player2 = game.Players:FindFirstChild(Player.Values.Cuffing.Value)

		Player2.Values.Cuffed.Value = false
		Player2.Character.HumanoidRootPart.Anchored = false
		Player2.Character.Humanoid.PlatformStand = false

		-- Remove tools from Player2's backpack
		for i, v in pairs(Player2.Backpack.Storage:GetChildren()) do
			if v:IsA("Tool") then
				v.Parent = Player2.Backpack
			end
		end
	end
end)

Remotes.UnCuff.OnServerEvent:Connect(function(Player, Plr2)
	local PlayerObject = game.Players:FindFirstChild(Plr2)

	--Player2 Values--
	if PlayerObject then
		PlayerObject.Values.Cuffed.Value = false
		PlayerObject.Character.HumanoidRootPart.Anchored = false
		PlayerObject.Character.Humanoid.PlatformStand = false

		-- Remove tools from Player2's backpack
		for i, v in pairs(PlayerObject.Backpack.Storage:GetChildren()) do
			if v:IsA("Tool") then
				v.Parent = PlayerObject.Backpack
			end
		end
	end

	--Player1 Values--
	Player.Values.Cuffing.Value = ""
end)

-- Jail Logic --
Remotes.Jail.OnServerEvent:Connect(function(Player, Plr2, Time, Reason)
	print("Jail fired")
	local PlayerObject = game.Players:FindFirstChild(Plr2)

	-- Check if the player has cuffs
	if Player.Character then
		if not Player.Character:FindFirstChild("Cuffs") then
			return Player:Kick("no")
		end
	end

	-- Uncuff Player if cuffed
	UnCuff(Player.Name, PlayerObject.Name)
	Player.Values.Cuffing.Value = ""
	PlayerObject.Values.Cuffed.Value = false

	-- Unequip tools and remove them from backpack
	PlayerObject.Character.Humanoid:UnequipTools()
	for _, tool in pairs(PlayerObject.Backpack:GetChildren()) do
		if tool:IsA("Tool") then
			tool:Destroy()
		end
	end

	-- Set jail values
	PlayerObject.Values.JailTime.Value = Time
	PlayerObject.Values.JailReason.Value = Reason

	-- Move the player to jail spawn
	wait(0.2)
	PlayerObject.Character:MoveTo(workspace.Map.Spawns.Jail.JailSpawn1.Position)

	-- Timer for JailTime
	local startTime = tick()  -- Track the start time
	local remainingTime = Time
	print("Starting jail time countdown...")

	-- Decrement JailTime every second
	while remainingTime > 0 do
		local elapsed = tick() - startTime
		if elapsed >= 1 then
			remainingTime = remainingTime - 1
			PlayerObject.Values.JailTime.Value = remainingTime
			startTime = tick()  -- Reset start time after each second
			print("Remaining time: " .. remainingTime)
		end
		wait(0)  -- Keep the loop running smoothly
	end

	-- After jail time is over
	if remainingTime <= 0 then
		PlayerObject:LoadCharacter()  
		PlayerObject.Character:MoveTo(workspace.Map.Spawns.Jail.JailSpawn1.Position)
		PlayerObject:WaitForChild("PlayerGui"):WaitForChild("JailTimerGUI"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true) -- To reset the GUI if needed

		-- Send webhook message about the jail
		local embedData = {
			["title"] = "Player Jailed",
			["description"] = Player.Name.." has jailed "..PlayerObject.Name.." for **"..Time.."** seconds. \n Reason(s): **"..Reason.."**",
			["color"] = 16711680 -- Red color
		}
		local messageData = {["embed"] = embedData}
		local jsonData = game.HttpService:EncodeJson(messageData)

		local success, errorMessage = pcall(function()
			game.HttpService:PostAsync(webhookUrl, jsonData)
		end)

		if not success then
			warn("Webhook failed to send: " .. errorMessage)
		else
			print("Webhook sent successfully!")
		end
	end
end)

Note----i have also another webhook who is working fine is just this jail system problem only