Never used region 3 before, trying to make an area indicator system.
Saw someone on youtube make one so i tried something similar, but with a module.
code:
local Players = game:GetService("Players")
local player = game.Players.LocalPlayer
local RS = game:GetService("RunService")
local areaIndex = require(script.areaIndex)
local char = player.Character
local folder = game.ReplicatedStorage.GetAreas:InvokeServer()
print(folder)
for _, area in folder do
print("exist")
local region = Region3.new(area.Position - (area.Size / 2), area.Position + (area.Size / 2))
local inRegion = false
local function RenderStepped()
inRegion = false
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = {char}
local parts = workspace:GetPartBoundsInBox(region.CFrame, region.Size, params)
for _,v in parts do
if v:IsDescendantOf(char) then
inRegion = true
break
else
continue
end
end
if inRegion then
print("in da zone")
areaIndex:SetArea(player,area.Name)
else
areaIndex:EndArea(player)
end
end
RS.RenderStepped:Connect(RenderStepped)
end
inRegion never returns true for some reason. Ive checked the physical indicator blocks, nothing happens. This is running in a local script in startergui, the module is a child of the local script.
Anyone know why this wont work?