markaaron
|
  |
| Joined: 21 Feb 2011 |
| Total Posts: 455 |
|
|
| 03 Jun 2015 07:39 PM |
how can I change this so it will wait for this(function nonTouched(hit)) function to take place before it can continue with the script?
function onTouched(hit)
print("Door Hit")
Door2.Transparency = 1
Door2.CanCollide = false Door1.CanCollide = true
Door1.Transparency = 0
script.Parent.Music:Play()
wait for function would be here -> function nonTouched(hit)
Door1.CanCollide = false
Door1.Transparency = 1
Door2.CanCollide = true
Door2.Transparency = 0
script.Parent.Music:Play() wait(0.3) script.Parent.Music:Stop()
end |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 03 Jun 2015 07:46 PM |
script.Parent.Touched:connect(onTouched) script.Parent.Touched:wait()
-- stuff after it is touched |
|
|
| Report Abuse |
|
|
markaaron
|
  |
| Joined: 21 Feb 2011 |
| Total Posts: 455 |
|
|
| 03 Jun 2015 08:41 PM |
| where do I put it? how do I set it up? and PLEASE name the functions as the functions I used |
|
|
| Report Abuse |
|
|
markaaron
|
  |
| Joined: 21 Feb 2011 |
| Total Posts: 455 |
|
|
| 03 Jun 2015 08:43 PM |
| that's not what I wanted I want it to do the first half of the script then the function will wait for you to stop touching it not how long till the script starts |
|
|
| Report Abuse |
|
|
Darkenus
|
  |
| Joined: 17 Jul 2014 |
| Total Posts: 1997 |
|
|
| 03 Jun 2015 08:45 PM |
| I don't get what you mean by, "wait for function would be here -> function nonTouched(hit)" |
|
|
| Report Abuse |
|
|
|
| 03 Jun 2015 08:53 PM |
.TouchEnded:wait()
Although you might want a more complicated system depending on what you're doing. |
|
|
| Report Abuse |
|
|
markaaron
|
  |
| Joined: 21 Feb 2011 |
| Total Posts: 455 |
|
|
| 04 Jun 2015 04:05 PM |
ok when I touch the brick it will do this
function onTouched(hit)
print("Door Hit")
Door2.Transparency = 1
Door2.CanCollide = false Door1.CanCollide = true
Door1.Transparency = 0
script.Parent.Music:Play()
and then it will *WAIT* for this function to take place in other words it will *WAIT* for me to stop touching it and when that function takes place it wil do this
function nonTouched(hit)
Door1.CanCollide = false
Door1.Transparency = 1
Door2.CanCollide = true
Door2.Transparency = 0
script.Parent.Music:Play() wait(0.3) script.Parent.Music:Stop()
end
and then the script will end GET IT NOW?!?!?
|
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 04 Jun 2015 04:09 PM |
| Your code is horribly formatted and you are not at all clear about what you want. Typing in caps doesn't help. |
|
|
| Report Abuse |
|
|
|
| 04 Jun 2015 04:09 PM |
script.Parent.Touched:connect(function(hit) --code repeat local hit2 = script.Parent.ToucheEnded:wait() until hit == hit2 --code end) |
|
|
| Report Abuse |
|
|
|
| 04 Jun 2015 04:14 PM |
First of all nothing will run since the function(s) aren't executed. You didn't give enough information pertaining to where is the script in and you never labeled it fully.
Give us the whole script if this is it then, We can't help you and it won't run. |
|
|
| Report Abuse |
|
|
markaaron
|
  |
| Joined: 21 Feb 2011 |
| Total Posts: 455 |
|
|
| 04 Jun 2015 04:33 PM |
| yay thank you sooo much :D |
|
|
| Report Abuse |
|
|
|
| 04 Jun 2015 04:42 PM |
| np, glad I could be of help. |
|
|
| Report Abuse |
|
|