t_p0t
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 11 |
|
|
| 17 Jul 2016 03:00 PM |
Sorry about the nooby question, I've been building for a while and I've just recently started getting into scripting. I was wondering if there was a way to instead of create a new CFrame very time you want to move a part use some other command to just move it up by some certain amount.
EXAMPLE:
function onTouch(hit) repeat script.Parent.CFrame.MoveUpBy (0,5) until script.Parent.Position = (0,5,0)
end script.Parent.Touched:connect(onTouch)
Like I said, I'm very new to this, and most of that is probably wrong, corrections appreciated. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 03:02 PM |
function onTouch(hit) repeat script.Parent.CFrame = CFrame.new(script.Parent.CFrame + Vector3.new(0, 1, 0) wait() until script.Parent.Position = (0, 5, 0) end
script.Praent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 03:03 PM |
repeat script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0,5,0) until script.Parent.CFrame.p=Vector3.new(0,5,0) |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 03:04 PM |
@Titanic
you misspelled parent rip
function onTouch(hit) repeat script.Parent.CFrame = CFrame.new(script.Parent.CFrame + Vector3.new(0, 1, 0) wait() until script.Parent.Position = (0, 5, 0) end
script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
t_p0t
|
  |
| Joined: 18 Dec 2011 |
| Total Posts: 11 |
|
|
| 17 Jul 2016 05:57 PM |
Figured it out, edited some of the code you guys sent.
a = 9 function onTouch() repeat script.Parent.Position = Vector3.new(0,a,0) a = a + 1 wait(1) until a == 16 wait (1) repeat script.Parent.Position = Vector3.new(0,a,0) a = a - 1 wait(1) until a == 9 end
script.Parent.Touched:connect(onTouch)
some of it wasn't working and I had to patch it up, I can change the value of a and the wait time to make it move smoother. |
|
|
| Report Abuse |
|
|