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?

5 comments

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.

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.

0

I don't think there's any other way.

0

loop it and see if its name is Center then it will get all results

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?