XTGNecro
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 18514 |
|
|
| 26 May 2014 06:58 PM |
I'm trying to make a brick (called part) have it's Reflectance value become 1, then change back to 0 after 2 seconds Nothing happens when I touch it
local Part = Workspace.Part
function onTouch(part) brick.Reflectance = 1 wait(2) brick.Reflectance=0
end
Part.Touched:connect (onTouch) |
|
|
| Report Abuse |
|
|
lupine
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 3561 |
|
|
| 26 May 2014 07:11 PM |
Delete the space between the ( and connect
Part.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 26 May 2014 07:28 PM |
The space doesn't matter The problem is you set a variable to Part and tried to change brick The script doesn't know what brick is |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
| |
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 26 May 2014 08:07 PM |
| Yeh I would change the name of the part also or put the script inside the part and refer to it as script.Parent |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 26 May 2014 08:13 PM |
local Part = Workspace.Part
function onTouch(part) Part.Reflectance = 1 wait(2) Part.Reflectance=0
end
Part.Touched:connect (onTouch)
That works, but you should add a debounce. |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 26 May 2014 11:06 PM |
^ sounds good
Since when did roblox make it Workspace.(part) instead of game.Workspace? |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
donatepls
|
  |
| Joined: 19 Apr 2013 |
| Total Posts: 56 |
|
|
| 27 May 2014 12:34 AM |
| I don't remember ever having to use "game.Workspace". Sure, it works, but what's the point of typing an extra word? |
|
|
| Report Abuse |
|
|
|
| 27 May 2014 01:30 AM |
| i dont know but got used to doing it |
|
|
| Report Abuse |
|
|
Qeary
|
  |
| Joined: 27 Jun 2013 |
| Total Posts: 5401 |
|
|
| 27 May 2014 02:05 AM |
local Part = game.Workspace.Part
function onTouch(part) brick.Reflectance = 1 wait(2) brick.Reflectance = 0
end Part.Touched:connect (onTouch) |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
JoBruin
|
  |
| Joined: 19 Feb 2012 |
| Total Posts: 5092 |
|
| |
|