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

How do I find the specific location of a part in the explorer?

Asked by 4 years ago
Edited 4 years ago

For example, I have a Part in game.ReplicatedStorage.Folder , and I have a table. I want to put the exact position the Part is in(game.ReplicatedStorage.Part) into the table. How am I able to get that exact position and how am I able to put it in the table without turning it into "Part"?

(Just one Part in Folder) Script =

local Parts = {} -- table
local APart = game.ReplicatedStorage.Anotherpart

for i,mds in pairs(game.ReplicatedStorage.Folder:GetChildren()) do
        if mds then
            table.insert(Parts,game.ReplicatedStorage.Folder..mds) --(Attempt) insert the location of the part
            APart = Models[i] --Changes the APart value into the value in Models (just to test)
                    print(APart) -- while outputting "Part", I cant get the location of Part.
                    APart:SetPrimaryPartCFrame(CFrame.new(PosX, PosY, PosZ))
        end
end

1 answer

Log in to vote
0
Answered by 4 years ago

So, for finding the part, you would want to do

CFrame.new(game.Workspace.[INSERT PART NAME].Position)

to get the X, Y, and Z location. I think you would also have to make 3 variables: - PosX - PosY - PosZ

Then you would set each of those variables to the XYZ values of the part.

PosX = CFrame.new(game.Workspace.TestPart.Position.X)
PosY = CFrame.new(game.Workspace.TestPart.Position.Y)
PosZ = CFrame.new(game.Workspace.TestPart.Position.Z)

Then you could go and add it into a table.

partLocation = {}
partLocation[1] = PosX
partLocation[2] = PosY
partLocation[3] = PosZ

Hope this helps, and happy coding!

0
I'm sorry but this isn't what I meant. I meant the place the object is in (game.Workspace.Folder.Part), not the xyz coordinates awesomecaysson 0 — 4y
Ad

Answer this question