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

How do I make this parent.part accept all siblings and not only focus on one part of the name?

Asked by 5 years ago
local Mag = (script.Parent.Center.Position-Player.Character.HumanoidRootPart.Position).magnitude

and if needed:

local Mag = (Door.Center.Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude

Parent.Center only accepts one part of the same name, however I need it to accept all parts of the same name. How do I achieve this?

1
You can use :GetChildren() to get all the children of Door, then use a if statement to check if it has the name "Center." After that, you can put them in a table and do the rest of your scripts. User#24541 10 — 5y
0
I'm very sure you can't just get all the children with the same name by just doing Instance.Instance. You have to at least use a iterator or something to get all the children, as I stated. User#24541 10 — 5y
0
I don't think there's any other way. User#24541 10 — 5y
0
loop it and see if its name is Center then it will get all results greatneil80 2647 — 5y
0
Do you want to teleport to the centre of all parts named lk'e that, or just to the centre of each part individually? marketmanager1 52 — 5y

Answer this question