|
| 28 Sep 2014 04:06 AM |
I recently started work on a new game and, not being much of a scripter but willing to have a go, I needed to design a brick that once stepped on, will cause lights to flash (and eventually sound to play, but I'm gonna sort the lights first) I have made the brick invisible but the script, (which I designed using elements off the roblox wiki for a door which became transparent when touched) doesn't seem to work. So if you could tell me what I did wrong and perhaps correct it? I would be very greatful, the script is as follows;
function onTouch(obj) script.Parent.Pointlight=true wait (0.5) script.Parent.Pointlight=false wait(0.5) script.Parent.Pointlight=true wait (0.5) script.Parent.Pointlight=false end script.Parent.Touched:connect(onTouch)
Thanks! |
|
|
| Report Abuse |
|
|
Roblok1
|
  |
| Joined: 27 Jul 2011 |
| Total Posts: 2019 |
|
| |
|
|
| 28 Sep 2014 04:22 AM |
| As I said, I know barely anything about scripting on roblox, so I am afraid I don't know how to even use debounce |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 04:29 AM |
local debounce = false
function onTouch(obj) if debounce == false then debounce = true script.Parent.Pointlight=true wait (0.5) script.Parent.Pointlight=false wait(0.5) script.Parent.Pointlight=true wait (0.5) script.Parent.Pointlight=false debounce = false end end script.Parent.Touched:connect(onTouch)
There, the debounce is added :) |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Sep 2014 04:41 AM |
| I added that in, but the lights do not flash or turn on when I step through the brick, the pointlight is in the brick along with the script :/ |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 04:46 AM |
script.Parent.Pointlight.Enabled=false
You forgot to put '.Enabled' each time |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 04:59 AM |
| I added the .Enabled in before each =false or =true It still isn't working though, Should it just be in the =false parts? Or is it just something I have done? Thanks for the help btw. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 05:01 AM |
Did you setup a listener?
local to_touch_part = game.Workspace.Example
touched_brick.Touched:connect(function()
end) |
|
|
| Report Abuse |
|
|
ohno1112
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 833 |
|
|
| 28 Sep 2014 05:16 AM |
function onTouch(obj) if debounce == false then debounce = true for i = 1, 10 do --this makes light flash 10 times. simply adjust the 10 script.Parent.Pointlight.Enabled = true wait (0.5) script.Parent.Pointlight.Enabled = false end debounce = false end end script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
ohno1112
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 833 |
|
|
| 28 Sep 2014 05:18 AM |
@ cody,
local to_touch_part = game.Workspace.Example
touched_brick.Touched:connect(function()
end)
makes no sense, first variables arent needed, second to_touch_part is not the same as touched_brick. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 05:37 AM |
I tried putting the script in but nothing happens, here are some of the settings for the brick; transparent:10 can collide : No The light is inside the brick and the script is also inside the brick but the script is not in the light. I think I am doing something wrong with the brick itself now, do I need a touch interest or something? I heard about them but not sure really what to do with it Thanks again guys
|
|
|
| Report Abuse |
|
|
ohno1112
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 833 |
|
|
| 28 Sep 2014 06:13 AM |
barracuda, i might want to have a closer look at what the culprit is. at the very least, it's not the script.
perhaps put your place in a model and PM me the link or something? |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 06:16 AM |
light = script.Parent flash = false
while flash == false do wait(13) flash = true light.Range = light.Range + 10 end while flash == true do wait(3) light.Range = light.Range -10 flash = false end |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 06:16 AM |
| Oh sorry wrong script. Didn't read all the post. |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 06:16 AM |
If theres anyone here that can help me build a game it will be needed i need a scripter :I?
|
|
|
| Report Abuse |
|
|