So basically, what happens is, the script runs and gets to all check points, but rejoin3 doesn’t detect any touching from teh humanoid; it worked 2 minutes before.
script:
local Rep = game:GetService("ReplicatedStorage")
local Event = Rep:WaitForChild("KOTH")
wait(1)
while true do
local koth = workspace:WaitForChild("KOTH", 5)
if not koth then return end
local hitbox = koth:WaitForChild("hitbox", 5)
if not hitbox then return end
local kings = table.create(game.Players.MaxPlayers)
local count = 60
while count > 0 do
count = count - wait(1)
Event:FireAllClients("COUNTDOWN", count)
local min = hitbox.Position - (0.5 * hitbox.Size)
local max = hitbox.Position + (0.5 * hitbox.Size)
local region = Region3.new(min, max)
local parts = workspace:FindPartsInRegion3(region, koth, 30) -- find players inside
local markedoff = {}
for i, v in pairs(parts) do
print(v.Name)
if not markedoff[v.Parent.Name] and v.Parent:IsA("Model") and v.Parent:FindFirstChild("Humanoid") then
print(v.Name)
local head = v.Parent:FindFirstChild("Head")
if head then
local gui = head:FindFirstChild("HeadGui")
if gui then
local label = gui.KOTH
label.Visible = true
local val = tonumber(label.Text)+1
label.Text = tostring(val)
kings[v.Parent.Name] = val
markedoff[v.Parent.Name] = true
end
end
end
end
if count < 1 then
wait(count)
break
end
end
local won = nil
local highest = 0
for i, v in pairs(game.Players:GetChildren()) do
if kings[v.Name] then
local head = v.Character:FindFirstChild("Head")
if head then
local gui = head:FindFirstChild("HeadGui")
if gui then
gui.KOTH.Visible = false
end
end
if kings[v.Name] > highest then
highest = kings[v.Name]
won = v
end
end
end
print(won)
if won ~= nil then
Event:FireAllClients("END", won.Name)
print(won.Name, " WON THE MATCH")
end
wait(30)
end
Thanks.