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

How to check a position for a part and get the part as a variable?

Asked by 4 years ago
Edited 4 years ago

I need help to this. Please if you know please tell me. And if you want to ask a question about my question then I will answer it :)

0
What do you mean by that, check for parts that are in a Vector3 position? ChrisTheRobloxPlayYT 256 — 4y
0
yes Saficcio 0 — 4y
0
You could iterate through all the parts in your game and see if any of then is at the position you want to check User#34187 8 — 4y
0
how do i do that Saficcio 0 — 4y
View all comments (3 more)
0
I mean in two parts, Local part = script.Parent and Saficcio 0 — 4y
0
Saficco make sure you edit the right script the one you found out. JesseSong 3916 — 4y
0
Saficcio edit the new script. JesseSong 3916 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

So you can get the position of the part by:

print(workspace.Position) -- This will print out the position of the part in workspace

So what you mean is if you add a vector3 position to a part you check the new position and get the part that if in that new position Here what i can do

local Part = workspace.Part -- Change this if needed
local Part2

local Target = Part.Position + Vector3.new(0,10,0)
for i,v in pairs(workspace.Model:GetChildren()) do -- Change the model name
    if v.Position == Vector3.new(Target) then
        Part2 = v
        print("Found! Yay")
    else
        print("Not Found")
    end
end

Hope this helped

0
I mean by a part that is not a variable and the with the main part you add a vector3 position then by checking if a part is in the added position then if a part is in the position then get it as a variable Saficcio 0 — 4y
0
im trying Saficcio 0 — 4y
0
Yea the script also don't work to me :/ Nguyenlegiahung 1091 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Brick Position

How you get a bricks position, you simply just need to get the Parts Position. This is a basic function of ROBLOX Studio.

Script

--[[Made By MillerrIAm]]--
--[Server Variables]--
local Part = script.Parent
local PartPosition = Part.Position
--[Main Script]--
print(PartPosition)

Answer this question