generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: wait for function

Previous Thread :: Next Thread 
markaaron is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
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 is not online. 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 is not online. 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
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
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
MKofOrbiter is not online. MKofOrbiter
Joined: 28 Aug 2010
Total Posts: 910
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 is not online. markaaron
Joined: 21 Feb 2011
Total Posts: 455
04 Jun 2015 04:33 PM
yay thank you sooo much :D
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
04 Jun 2015 04:42 PM
np, glad I could be of help.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image