local offset local function rotationoffset(part) local size = part.Size local areas = {…
- User
local offset
local function rotationoffset(part)
codelocal size = part.Size local areas = { XY = size.X * size.Y, XZ = size.X * size.Z, YZ = size.Y * size.Z } local largest = 0 local pair = "" for i, v in areas do if v > largest then largest = v pair = i end end if pair == "XY" then offset = CFrame.Angles(math.rad(90), 0, 0) elseif pair == "XZ" then offset = CFrame.Angles(0, 0, math.rad(90)) else offset = CFrame.identity endend
local part = workspace.Part
if part then
coderotationoffset(part) part.CFrame = CFrame.new() * offsetend
Why doesn't this script follow the instructions below:
make this code have an rotation offset variable at the top, and make it calculate the offset required so that i can do part.CFrame = CFrame.new(bla, bla, bla) * offset and it will have the biggest surface facing upwards. make sure that you do calculation that sets the rotation offset so that the largest surface is facing up. make sure to calculate all of that AFTER the part is fully found.
are you able to fix it?
Here's some more info to possibly help you understand what I'm trying to say.
For example, if the size of the part was Vector3.new(4, 14, 3), the orientation would be set to 90, 0, 0 because that allows the biggest surface to be facing up, and it also makes sure that the longways would be set to where it could almost look like the player is walking a plank.
Here are some example outputs I would want:
Size: 4, 14, 3
Orientation: 90, 0, 0
Size: 15, 1, 5
Orientation: 0, 90, 0
Size: 3, 1, 14
Orientation: 0, 0, 90
Do you understand what I want now?
- Assistant