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 » Scripting Helpers
Home Search
 

Re: Flashing Light Script (Help me!!!!!)

Previous Thread :: Next Thread 
barracuda4400 is not online. barracuda4400
Joined: 04 May 2009
Total Posts: 14
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 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
28 Sep 2014 04:10 AM
Where is the debounce?
Report Abuse
barracuda4400 is not online. barracuda4400
Joined: 04 May 2009
Total Posts: 14
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
HarrySnotte is not online. HarrySnotte
Joined: 27 Jun 2011
Total Posts: 2854
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
barracuda4400 is not online. barracuda4400
Joined: 04 May 2009
Total Posts: 14
28 Sep 2014 04:37 AM
Thanks :)
Report Abuse
barracuda4400 is not online. barracuda4400
Joined: 04 May 2009
Total Posts: 14
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
HarrySnotte is not online. HarrySnotte
Joined: 27 Jun 2011
Total Posts: 2854
28 Sep 2014 04:46 AM
script.Parent.Pointlight.Enabled=false

You forgot to put '.Enabled' each time
Report Abuse
barracuda4400 is not online. barracuda4400
Joined: 04 May 2009
Total Posts: 14
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
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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 is not online. 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 is not online. 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
barracuda4400 is not online. barracuda4400
Joined: 04 May 2009
Total Posts: 14
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 is not online. 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
themajestikst is not online. themajestikst
Joined: 19 Dec 2012
Total Posts: 137
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
themajestikst is not online. themajestikst
Joined: 19 Dec 2012
Total Posts: 137
28 Sep 2014 06:16 AM
Oh sorry wrong script. Didn't read all the post.
Report Abuse
bloxxerxxx3000 is not online. bloxxerxxx3000
Joined: 14 Jul 2013
Total Posts: 3
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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