Get a parts border coordinates


Imagine you got a simple block part. I want to add two colored border parts to the parts borders. From top view it should look like that:

The red lines are my borders.

My Problem

I don’t know how I would get the coordinates (= position) of those border parts. I think the only to relevant values are the parts size and position, but how would I get the border coordinates from them?

Edit: Note that the orienation of my part changes on one axis

Thanks in advance :smiley:

1 Like

Getting the part’s borders is simple, using this:

local leftBorder = part.CFrame *, 0, 0)
local rightBorder = part.CFrame *, 0, 0)

That is if, they’re positioned on the x-axis. If they’re positioned at the front / back, you’ll have to use the z-axis

1 Like

Does this method also consider the orientation?

Yes, multiplying a CFrame to another applies it in local space

1 Like

I tried to implement it into my script but my borders don’t seem to move. An excerpt:

Border1.CFrame = Part.CFrame *, 0, -Part.Size.Z/2)
Border2.CFrame = Part.CFrame *, 0, Part.Size.Z/2)

Did a make a mistake?

Have you checked the output for any errors?

Yes there are no errors. I also tried to print the parts CFrame before and after but nothing changed.

I should maybe add that I got a Model consisting of 3 parts: a main part and 2 borders. Those are welded together with WeldConstraints.

I disabled the WeldConstraints and it now works perfectly fine, Thank You :slight_smile: