Region3's being buggy possibly

Hi, so I’m making a voting system and I thought I just fixed this bug, but apparently it’s still going on. Basically, even though I’m standing on the second voting pad, it tells me I’m actually on the first one, and it doesn’t recognize me standing on the second one by any means. Not sure why this is even happening…

any help appreciated, here’s the code:

 for i = 1,2 do
	local pad = (i == 1 and pad1) or pad2
	local pad_min = pad.Collider.Position - (0.5 * pad.Collider.Size)
	local pad_max = pad.Collider.Position + (0.5 * pad.Collider.Size)
	local pad_region =, pad_max)
	for i,part in pairs(game.Workspace:FindPartsInRegion3(pad_region, nil, 500)) do
		if part.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(part.Parent.Name) and not voters[part.Parent.Name] then
			voters[part.Parent.Name] = true
			if i == 1 then
				pad1_votes = pad1_votes + 1
				pad2_votes = pad2_votes + 1

Assumedly, since we cannot see the rest of the code, you are resetting the variables pad1_votes and pad2_votes and the voters table every time you check the regions? Without these being reset, if players move from one pad to another, it won’t register it.

Otherwise, the region code looks completely fine.

1 Like

Thanks for your reply. And I only check this once, as it’d be expensive to run this every second or so. It waits 15 seconds for players to vote, then this code runs once and checks both pads to see how many players are on each one.

But, for whatever reason, it’s yielding very inaccurate results. (Says I’m on pad 1 but I’m actually on pad 2…)

The code provided in that case seems completely fine. It may be that elsewhere you are accidentally overwriting the values. Have you tried printing variables at various points throughout the script to validate and follow the values?

1 Like

Oops. Yeah you were right about overwriting something, just noticed this now. I used “i” as the variable for both for loops.


Thanks for your help. :slight_smile: