|
| 13 Aug 2013 06:41 PM |
| How can I make a button like the ones in p0rtal games? Like, when you stand or put a box on it a door opens, but when you get off or take the box off it closes? I have somewhat of an idea on how to do this but I am new to scripting for the most part. Thanks a lot helpers. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
| |
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37141 |
|
|
| 13 Aug 2013 07:01 PM |
@Inf
TouchEnded? Wow never heard of that thx
==Salinas23, LMaDer since August 2012! Scripter since July 2013! |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
| |
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 13 Aug 2013 07:02 PM |
Someone told me in another thread that TouchEnded doesn't fire if the player disconnects while touching the Part, so use Workspace:FindPartsInRegion3() instead, or check magnitude.
~ Oh, I'm sorry, did I break your concentration? ~ |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 13 Aug 2013 07:04 PM |
^
Possible to deteck player with magnitude without looping through the players? |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2013 07:31 PM |
| Ok these things sound helpful but I am really BAD at scripting and I can hardly understand how to apply Touch and TouchEnded. Give me some scripts please. |
|
|
| Report Abuse |
|
|
73EPIC311
|
  |
| Joined: 28 Aug 2012 |
| Total Posts: 454 |
|
|
| 13 Aug 2013 08:10 PM |
script.Parent.Touched:connect(function(hit) -- What you want to do here end)
script.Parent.TouchedEnded:connect(function() --What you want here end)
Put each in a seperate script inside the button. |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2013 08:12 PM |
| @infocus maybe just loop a magnitude check while its being touched, so if the player walks away touchEnded stops the loop, and if the player disconnects the magnitude loops goes "return end" or "break" whatever goats your float |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2013 08:22 PM |
| So, what do you guys think about Epics post? Is that going to work properly? |
|
|
| Report Abuse |
|
|
73EPIC311
|
  |
| Joined: 28 Aug 2012 |
| Total Posts: 454 |
|
| |
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
|
| 13 Aug 2013 08:35 PM |
The following didn't work when put into 2 separate scripts that were put into the button.
script.Parent.Touched:connect(function(hit) script.Parent.BrickColor = BrickColor.new("Hot pink") end
script.Parent.TouchedEnded:connect(function() script.Parent.BrickColor = BrickColor.new("Really red") end |
|
|
| Report Abuse |
|
|
73EPIC311
|
  |
| Joined: 28 Aug 2012 |
| Total Posts: 454 |
|
| |
|
|
| 13 Aug 2013 10:18 PM |
| Ok, did that and it works better. The thing is, when I stand on it, it turns hot pink like it should, but when I get off and or get off and get back on, it still remain hot pink when it should be turning back to really red. |
|
|
| Report Abuse |
|
|
73EPIC311
|
  |
| Joined: 28 Aug 2012 |
| Total Posts: 454 |
|
| |
|
|
| 16 Aug 2013 10:58 PM |
Make a door and a button group it then put this in button Function onTouched (hit) script.Parent.Parent.Door.Transparency = 1 script.Parent.Parent.Door.CanCollide = false wait (4) script.Parent.Parent.Door.Transparency = 0.1 script.Parent.Parent.Door.CanCollide = true end
script.Parent.touched:connect(onTouched)
Reply if it doesnt work It makes it so when you hit the button the door will disappear I think this is what you want
|
|
|
| Report Abuse |
|
|
|
| 16 Aug 2013 11:08 PM |
| Uncapitalize function by the way |
|
|
| Report Abuse |
|
|
shooter06
|
  |
| Joined: 13 Jan 2011 |
| Total Posts: 7443 |
|
| |
|