Why is this not working?, its a king of the hill script

script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) ~= nil then
while wait(.01) do
local chr = hit.Parent
local plr = game.Players:GetPlayerFromCharacter(chr)
script.Parent.BillboardGui.TextLabel.Text = "Current king : "… plr.Name
end
end
end)


if a one player touches the part it works, but when another player touches it, The text starts glitching i don’t know how would i make it so it wont show two player names glitching in the text.

You could try using :GetTouchingParts() to get all the parts (including characters) that are touching the top.

If no characters are detected, do not update the text
If the current king of the hill is detected, do not update the text
If a character is detected and the current king of the hill is not detected, then set the current king of the hill to that player

Using Region3 and FindPartsInRegion3 might work better.