Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you set position of another brick?

If I wanted to set the position of a brick1 to the position of brick2 but 3 studs higher, how would I do it? I tried this and it didn't work, and the wiki didn't really say much on it:

myCode = [[ p = Instance.new("Part", game.Workspace)
	p.Anchored = true 
	p.Position = Workspace.SpawnLocation.Position.Y + 3 ]]

wait(5)

loadstring(myCode)()

(In this case I was setting a bricks position 3 studs above the spawn brick, I know you can just manually look at the bricks position and add 3 to the y-axis, but what about if you wanted to just do it this way?)

2 answers

✓ Accepted answer

You need to use Vector3, which is a 3-D measurement.

Try this -

myCode = [[ p = Instance.new("Part", game.Workspace)
    p.Anchored = true 
    p.Position  =game. Workspace.SpawnLocation.Position + Vector3.new(0,3,0) ]]

wait(5)

loadstring(myCode)()

With this you're telling the system that you want to move the subject 3 studs higher in 3-D space.

Tell me if this works.

1 comment

0

Yes! This is what I was looking for, and it works. Thanks.

You could make another brick on top of the spawn that is invisible (transparency 1 and anchored) and have the brick spawn there..

THIS MAY NOT WORK Or you would do p.Position = Workspace.SpawnLocation.Position.y = (the y position) that means you just have to change the y axis location Please don't kill me if it doesn't work

1 comment

0

I appreciate the answer, but what I'm asking is how to change it to the spawn location's y-axis + 3, without using invisible bricks.

This discussion is preserved as it was. New answers, comments, and votes are closed.