Since I think region3 is better for me so I decided use it anyways, but I don’t understand what’s wrong with the code?
For e.x you can walk at medium part which is works weird, the large is decent, small is decent too!
Anyone have a good alternative to use?
function isOn(part,plr)
local min = part.Position - (.5 * part.Size)
local max = part.Position + (.5 * part.Size)
local region = Region3.new(min,max):ExpandToGrid(1)
while task.wait() do
local parts = game.Workspace:FindPartsInRegion3(region,part,math.huge)
for i,v in pairs(parts) do
local parent = v.Parent
if parent:FindFirstChild("Humanoid") and parent:FindFirstChild("Humanoid").MoveDirection ~= Vector3.new(0,0,0) and parent:FindFirstChild("Humanoid").Health > 0 then
part.BrickColor = BrickColor.new("Really black")
plr.object.Value = part
break
else
part.BrickColor = BrickColor.new("Institutional white")
if plr.object.Value == part then
plr.object.Value = nil
end
end
end
if #parts == 0 then
part.BrickColor = BrickColor.new("Institutional white")
end
end
end
for _, v in pairs(workspace.level10:GetChildren()) do
v.Touched:Connect(function(hit)
if hit.Parent.Humanoid then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.object.Value = v
isOn(v,player)
end
end)
end
PartColor.rbxl (26.9 KB)