|
| 19 Aug 2012 10:38 AM |
Is there a command to see while something is being touched. Let's say I have a brick and I need it so while it's being touched it will turn red while it's not being toched it will turn blue.
And no I don't mean the touched function.
|
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 10:40 AM |
| .Touched event and .TouchedEnded event. |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 10:40 AM |
Could you give me an example of it in a script? Thanks.
|
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 10:42 AM |
Sorry, TouchEnded*
http://wiki.roblox.com/index.php/TouchEnded_(Event) |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 10:44 AM |
No I wanted it so it's like this.
a = script.parent
beingtouched = False
While touched do beingtouched = true end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 19 Aug 2012 10:49 AM |
| Yes, you did make a nice spam post, :3. |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 10:50 AM |
| Just use magnitude... I was hoping you'd get the memo. I mean really, there are tons of ways to do this, -_-... |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:20 AM |
Well I don't get it. sooo yeah..
Bump. |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:23 AM |
beingtouched = false
script.Parent.Touched:connect(fucntion() beingtouched = true end)
script.Parent.TouchEnded:connect(fucntion() beingtouched = false end) |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:24 AM |
Thanks that's just what I was looking for. :3
|
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:31 AM |
I tried this
local self = script.Parent local beingtouched = false
script.Parent.Touched:connect(fucntion() beingtouched = true self.BrickColor = BrickColor.new("Blue") end)
script.Parent.TouchEnded:connect(fucntion() beingtouched = false self.BrickColor = BrickColor.new("Gray") end)
12:29:07 - Workspace.Part.Script:5: ')' expected (to close '(' at line 4) near 'beingtouched' |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:33 AM |
script.Parent.Touched:connect(fucntion() script.Parent.BrickColor = BrickColor.new("Blue") end)
script.Parent.TouchEnded:connect(fucntion() script.Parent.BrickColor = BrickColor.new("Gray") end) |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:39 AM |
I don't see what you changed.
I had a variable called self.
|
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:39 AM |
I tried
script.Parent.Touched:connect(fucntion() script.Parent.BrickColor = BrickColor.new("Blue") end)
script.Parent.TouchEnded:connect(fucntion() script.Parent.BrickColor = BrickColor.new("Gray") end)
But got this in output again
Workspace.Part.Script:2: ')' expected (to close '(' at line 1) near 'script' |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:39 AM |
| Also I don't think "Blue" and "Gray" are brick colors... Just use it. |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:40 AM |
OH WOW, I spelt Fucntion, not function for both of them.. Here:
script.Parent.Touched:connect(function() script.Parent.BrickColor = BrickColor.new("Navy blue") end)
script.Parent.TouchEnded:connect(function() script.Parent.BrickColor = BrickColor.new("Gray") end) |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 19 Aug 2012 11:41 AM |
local self = script.Parent local touches = 0
self.Touched:connect(function () touches = touches + 1 self.BrickColor = BrickColor.new("Blue") end)
self.TouchEnded:connect(function () touches = math.max(touches - 1, 0) -- just in case, we don't want to go negative
if touches == 0 then self.BrickColor = BrickColor.new("Gray") end end)
This better supports multiple objects touching this part. |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 11:42 AM |
| Bright blue and Medium stone grey. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 19 Aug 2012 11:43 AM |
| @Care he could have been talking to you, or the two above you... |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2012 12:02 PM |
I was talking to 18cwat.
Care did pretty much nothing for me. |
|
|
| Report Abuse |
|
|