Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Could someone help me figure out why this brick that I am instancing, is incorrectly placing itself?

Asked by 8 years ago

Hey, guys/gals. Was hoping you could help me on something.

I can't get this part, called Sandbag1, to position correctly. Whenever I try and place it, it always places above where it should be. I checked the placement position I have in, and it is correct.

Code:

local Create = assert(LoadLibrary("RbxUtility")).Create
Sandbag1 = Create("Part"){CanCollide = false, Parent = Sandbags, BrickColor = BrickColor.new("Burlap"), Position = Vector3.new(-10.389, -1.394, -4.478), Rotation = Vector3.new(-90, -85, -105), Anchored = true, Size = Vector3.new(3, 1.2, 1), BottomSurface = Enum.SurfaceType.Smooth, TopSurface = Enum.SurfaceType.Smooth}

It should be placing at -1.394, but it places at 2.348, and I cannot figure out why. Its CanCollide is set to false before its placement, so it couldn't be that it was trying to go inside of another part and Collide with it.

I've been at this for a while now, and I am stumped, could one of you guys/gals help me at all?

Thanks!

0
I'm not entirely sure if this will work, but try using CFrame instead of Position. nilVector 812 — 8y
0
Yes. That works! Thank you so much! Julian_Orteil 48 — 8y
0
If a parts position is set to a value and it detects a collision, it will raise the part until no collision is detected. GoldenPhysics 474 — 8y
3
You should break giant statements like this onto multiple lines. I suggest a newline after `{`, and each comma BlueTaslem 18071 — 8y
0
Hey I had this exact same problem almost a year ago. Learning how to use CFrame was the best thing I did. AZDev 590 — 8y

Answer this question