Answers for "how to make capture area in roblox"

0

how to make capture area in roblox

--put this in part

local function isPointInZone(point, zonePart)
    local relPoint = zonePart.CFrame:PointToObjectSpace(point)
    return math.abs(relPoint.X) < zonePart.Size.X * 0.5 and math.abs(relPoint.Z) < zonePart.Size.Z * 0.5
end

local playersInZone = {}
local function onHeartbeat(dt)
    for i, player in pairs(game.Players:GetPlayers()) do
        if player.Character and player.Character.PrimaryPart and isPointInZone(player.Character.PrimaryPart.Position, script.Parent) then
               playersInZone[player.UserId] = true
        else
              playersInZone[player.UserId] = nil
        end
    end
end
Posted by: Guest on January-31-2022

Code answers related to "how to make capture area in roblox"

Browse Popular Code Answers by Language