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 » Scripters
Home Search
 

Re: can someone help me fix this script?

Previous Thread :: Next Thread 
360ghostrider is online. 360ghostrider
Joined: 12 Apr 2013
Total Posts: 3
11 Jun 2017 11:05 PM
open=true

script.Parent.MouseClick:connect(function()
if open==true then
open=false
while true do
script.Parent.Parent.Parent.Light_Red.Material =("Neon")
script.Parent.Parent.Parent.Light_Red.PointLight.Enabled=true
wait(0.2)
script.Parent.Parent.Parent.Light_Red.PointLight.Enabled=false
script.Parent.Parent.Parent.Light_Red.Material =("SmoothPlastic")
wait(0.2)
end --anything below this wont work >:(
while true do
script.Parent.Parent.Parent.Light_Blue.Material =("SmoothPlastic")
wait(0.2)
script.Parent.Parent.Parent.Light_Blue.Material =("Neon")
script.Parent.Parent.Parent.Light_Blue.PointLight.Enabled=true
wait(0.2)
script.Parent.Parent.Parent.Light_Blue.PointLight.Enabled=false
end
else
open=true
script.Parent.Parent.Parent.Light_Blue.Material=("SmoothPlastic")
script.Parent.Parent.Parent.Light_Blue.SpotLight.Enabled=false
script.Parent.Parent.Parent.Light_Red.Material=("SmoothPlastic")
script.Parent.Parent.Parent.Light_Red.SpotLight.Enabled=false

end
end)
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
11 Jun 2017 11:10 PM
The reason why the code below your while loop doesn't work is because your first while loop is still going on and on. It hasn't completed its loop because it'll always be true. So if I am thinking right, you made an infinite loop which means it won't go to the next loop.
Report Abuse
360ghostrider is online. 360ghostrider
Joined: 12 Apr 2013
Total Posts: 3
11 Jun 2017 11:48 PM
how do i fix it?
Report Abuse
freeroblox1234567 is online. freeroblox1234567
Joined: 19 May 2011
Total Posts: 120
12 Jun 2017 02:36 AM
Basically anything below the first "while true do" won't run because the first one is still looping, try doing :

for i = 1, (number of times you want it to loop) do
script.Parent.Parent.Parent.Light_Red.Material =("Neon")
script.Parent.Parent.Parent.Light_Red.PointLight.Enabled=true
wait(0.2)
script.Parent.Parent.Parent.Light_Red.PointLight.Enabled=false
script.Parent.Parent.Parent.Light_Red.Material =("SmoothPlastic")
wait(0.2)
end
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
12 Jun 2017 08:43 PM
I'm not necessarily sure how you want this code to execute but what you can do is create the MouseClick event to control the boolean open, and have an if statement in a while loop to check if the boolean is true or false. I also combined the two while loops you had and put it into one and assumed that you may have wanted to have certain things done if open was true, and other things done if open was false.

open=true
part = script.Parent

script.Parent.MouseClick:connect(function()
if open then
open = not open
end
end)

while true do
if open then
script.Parent.Parent.Parent.Light_Red.Material =("Neon")
script.Parent.Parent.Parent.Light_Red.PointLight.Enabled=true
script.Parent.Parent.Parent.Light_Blue.Material =("SmoothPlastic")

wait(0.2)

script.Parent.Parent.Parent.Light_Blue.Material =("Neon")
script.Parent.Parent.Parent.Light_Blue.PointLight.Enabled=true
script.Parent.Parent.Parent.Light_Red.PointLight.Enabled=false
script.Parent.Parent.Parent.Light_Red.Material =("SmoothPlastic")

wait(0.2)

script.Parent.Parent.Parent.Light_Blue.PointLight.Enabled=false
script.Parent.Parent.Parent.Light_Blue.Material =("SmoothPlastic")

wait(0.2)

script.Parent.Parent.Parent.Light_Blue.Material =("Neon")
script.Parent.Parent.Parent.Light_Blue.PointLight.Enabled=true

wait(0.2)

script.Parent.Parent.Parent.Light_Blue.PointLight.Enabled=false
else
script.Parent.Parent.Parent.Light_Blue.Material=("SmoothPlastic")
script.Parent.Parent.Parent.Light_Blue.SpotLight.Enabled=false
script.Parent.Parent.Parent.Light_Red.Material=("SmoothPlastic")
script.Parent.Parent.Parent.Light_Red.SpotLight.Enabled=false
end
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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