so i got a region3 script that is supposed to detect players but it doesnt if someone could help me with this that would be appreciated last time i asked this question a dude thought he would be funny and close the question like im not here asking for help on a serious topic

script:

local top = script.Parent.TopCorner.Position
local bottom = script.Parent.BottomCorner.Position
local TheRegion = Region3.new(top, bottom)
local blackjb = Instance.new("Part")
blackjb.Anchored = true
blackjb.CanCollide = false
blackjb.BrickColor = BrickColor.new("Baby blue")
blackjb.Transparency = 0.6
blackjb.Parent = workspace
blackjb.Size = TheRegion.Size
blackjb.CFrame = TheRegion.CFrame--CFrame.new((top+bottom)/2)
local size = top - bottom
blackjb.Size = Vector3.new(math.abs(size.X),math.abs(size.Y),math.abs(size.Z))
blackjb.Name = "MyCarDrivesItself"
while true do
	wait(4)
for _, part in pairs(workspace:FindPartsInRegion3(TheRegion, nil, math.huge)) do
    local character = nil
    if part.Parent:FindFirstChild("Humanoid") then 
        character = part.Parent
    elseif part.Parent.Parent:FindFirstChild("Humanoid") then
        character = part.Parent.Parent
    end
    if character then
        local player = game.Players:GetPlayerFromCharacter(character)
        if player then
            print(player.Name)
			end
        end
    end
end

2 comments

0

Well, you’re only checking if anyone is in the Region3 once. Do you want it to check constantly? Are the players already supposed to be in the Region3 when the script runs?

0

sorry forgot to add the while true do when asking this question but yeah i was wanting it to constantly check but it doesn't even with the while true do