What does the code do and what are you not satisfied with?
I want to make a code that checks if the player got out from the region but it’s too complex and I think it can be optimized.
What potential improvements have you considered?
I don’t know maybe region3 but the only way to know if the part is in region3
is by using GetPartsInRegion3()
How (specifically) do you want to improve the code?
By reducing the operations of the code
The code is in Starter Character
run = game:GetService("RunService") Prison = workspace.Region3:WaitForChild("Prison") Head = script.Parent:WaitForChild("Head") run.RenderStepped:Connect(function() if Head.Position.X < Prison.Position.X - Prison.Size.X / 2 and Head.Position.X > Prison.Position.X + Prison.Size.X / 2 then if Head.Position.Y < Prison.Position.Y - Prison.Size.Y / 2 and Head.Position.Y > Prison.Position.Y + Prison.Size.Y / 2 then if Head.Position.Z < Prison.Position.Z - Prison.Size.Z / 2 and Head.Position.Z > Prison.Position.Z + Prison.Size.Z / 2 then --Bruhmongus print("I'VE GOTTEN OFF DA PRISON") end end end end)