|
| 13 Jan 2014 10:18 AM |
Okay so basically i have a button, a moving brick and a stopper i am making it so when the Button is touched the moving brick begins to move and once it reaches the stopper it stops but im stuck on a part of it.
what do i add to the until loop to make it stop when it touches the stopper?
Something like this : until movingbrick touching stopper |
|
|
| Report Abuse |
|
|
Thaeh
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 7685 |
|
| |
|
|
| 13 Jan 2014 10:22 AM |
| Thats a little mean don't you think? Since I've clearly explained what i have done and what i need help with... Even if i paste the script you could not help me because there's nothing wrong with the script... I'm asking for assistance on a certain look i don't know how to finish. If you won't help me don't comment. |
|
|
| Report Abuse |
|
|
| |
|
Thaeh
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 7685 |
|
|
| 13 Jan 2014 10:23 AM |
| no scripts no way to implement |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2014 10:24 AM |
MB = script.Parent.Parent.MovingBrick Stop = script.Parent.Parent.Stopper
function onTouched(hit) repeat MB.CFrame=MB.CFrame+Vector3.new( 0, 0 , -.5) until MB -- THIS AREA IS WHERE I AM CONFUSED end script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
Thaeh
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 7685 |
|
|
| 13 Jan 2014 10:27 AM |
until MB.CFrame.x == Stop.CFrame.x - MB.CFrame.Size.x
you might want to change the minus to plus or the vectors depending on what direction and orientation they go |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2014 10:30 AM |
| It saids Size is not a valid member |
|
|
| Report Abuse |
|
|
Thaeh
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 7685 |
|
|
| 13 Jan 2014 10:32 AM |
| it's not, you have to change it to fit your game. |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2014 10:35 AM |
Would it not make more sense to use until MB.Position == Stop.Position? |
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Jan 2014 10:38 AM |
What do you mean by i have to change it to fit my game... All i want is this:
Moving Brick = $ Stopper = % Button = 0
0$ %
When Button is touched
0 $>>>>> %
until Moving brick touched Stopper
0 $%
then Moving brick stops, |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 13 Jan 2014 10:59 AM |
MB = script.Parent.Parent.MovingBrick Stop = script.Parent.Parent.Stopper
function onTouched(hit) repeat MB.CFrame=MB.CFrame+Vector3.new( 0, 0 , -.5) until StopMoving StopMoving = nil end script.Parent.Touched:connect(onTouched) Stop.Touched:connect(function(hit) if hit == MB then StopMoving = true end end)
So what I editted is: If the stopper gets touched, a function will be called. It checks whether the block which touched him is the moving block or not. If it IS the moving block, a global variable 'StopMoving' will be set to true. Then the loop knows that he has to stop moving and then it will stop moving and will set the global variable 'StopMoving' to nil again :)
Hope you understand it and I hope that it works and helps :)
~sycips~ |
|
|
| Report Abuse |
|
|
EcIiptic
|
  |
| Joined: 12 Aug 2009 |
| Total Posts: 13737 |
|
|
| 13 Jan 2014 11:20 AM |
| Ugh just learn to use body position. Makes everything a lot simpler. |
|
|
| Report Abuse |
|
|