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

Vector 3, Position help?

I have a code and what it is doing is moving my part to the position 0 and it goes up starting on 1 and goes to 50 but how do i make it so where ever i put the part it stays there and goes up 50 instead of it being moved to the position 0? Any Help would be much appreciated, Thx!

for i = 1 , 50 do
	wait(0.001)
		workspace.Part.Position=Vector3.new(0,i,0)
			end

2 answers

You can anchor the part then it's done. You can use CFrame instead of Vector3 incase there is a part in the way like a player so instead of the part's y axis is jumping from 1 to 7, you can make the part go through any part.

for i = 1 , 50 do
    wait(0.001)
        workspace.Part.CFrame=CFrame.new(0,i,0)
            end

If you want it to fall after it reaches 50 studs do this:

for i = 1 , 50 do
    wait(0.001)
        workspace.Part.CFrame=CFrame.new(0,i,0)
if i == 50 then
	workspace.Part.Anchored = false
end
            end


No lets help you on your question: how to make the part go up in the position it is already in.

workspace.Part.Position.X = 0 --Notice the X. Position can be split up into 3 parts. X,Y,Z(since this is a 3D game). We can keep the X and Z the same but only change the Y.

--Like this:

for i = 1 , 50 do
    wait(0.001)
        workspace.Part.CFrame=CFrame.new(workspace.Part.Position.X,i,workspace.Part.Position.Z)
            end

It's really simple. Hope it helps!


EDIT

for i = 1 , 50 do
    wait(0.001)
        workspace.Part.CFrame=CFrame.new(workspace.Part.Position.X,i,workspace
.Part.Position.Z) --Watch out! This is the part that got cut off.
            end

Thanks, but i put a touched script in there and now it teleports to the position 0 again:l

function ontouched(hit)

for i=1,50 do
	
	wait(0.001)
	
	workspace.Part.CFrame=CFrame.new(workspace.Part.Position.X,i,workspace)

end
	
	end

script.Parent.touched:connect(ontouched)

4 comments

0

Problem is on line 7. The code went off the line cause it was too long. Just copy my script, go over my script and click the image of 2 papers then edit that into a touched script.

0

The script got cut off on line 7.

0

Is there an easier way to make it so where ever i place the block and touch it that's where it goes up?

0

Nope sadly :C Unless you replace the X and Z axis with the parts X and Z.

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