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

Vector 3, Position help?

Asked by 9 years ago

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

Log in to vote
1
Answered by 9 years ago

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
Ad
Log in to vote
0
Answered by 9 years ago

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)

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. EzraNehemiah_TF2 3552 — 9y
0
The script got cut off on line 7. EzraNehemiah_TF2 3552 — 9y
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? QuantumScripter 48 — 9y
0
Nope sadly :C Unless you replace the X and Z axis with the parts X and Z. EzraNehemiah_TF2 3552 — 9y

Answer this question