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 5 years ago
Edited 5 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 — 5y
0
yes Saficcio 0 — 5y
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 — 5y
0
how do i do that Saficcio 0 — 5y
View all comments (3 more)
0
I mean in two parts, Local part = script.Parent and Saficcio 0 — 5y
0
Saficco make sure you edit the right script the one you found out. JesseSong 3916 — 5y
0
Saficcio edit the new script. JesseSong 3916 — 5y

2 answers

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

So you can get the position of the part by:

1print(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

01local Part = workspace.Part -- Change this if needed
02local Part2
03 
04local Target = Part.Position + Vector3.new(0,10,0)
05for i,v in pairs(workspace.Model:GetChildren()) do -- Change the model name
06    if v.Position == Vector3.new(Target) then
07        Part2 = v
08        print("Found! Yay")
09    else
10        print("Not Found")
11    end
12end

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 — 5y
0
im trying Saficcio 0 — 5y
0
Yea the script also don't work to me :/ Nguyenlegiahung 1091 — 5y
Ad
Log in to vote
0
Answered by 5 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

1--[[Made By MillerrIAm]]--
2--[Server Variables]--
3local Part = script.Parent
4local PartPosition = Part.Position
5--[Main Script]--
6print(PartPosition)

Answer this question