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: Script Debug Help?

Previous Thread :: Next Thread 
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 03:21 PM
I need help fixing this, for some reason it won't work.


function onClicked()
print("Hello World!")

if script.Parent.IsOff == true
then

script.Parent.IsOn.Value = true
script.Parent.IsOff.Value = false

if script.Parent.IsOff == false
then

script.Parent.IsOn.Value = false
script.Parent.IsOff.Value = true

if script.Parent.IsOn.Value == true
then

script.Parent.Parent.CealingLight1.Light1.SpotLight.Enabled = true
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = true
wait(1)
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = false

while true do
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = false
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = true
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = false

if script.Parent.IsOn == true then
script.Parent.Parent.CealingLight1.Light1.SpotLight.Enabled = false
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = false
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enable = false



script.Parent.ClickDetector.MouseClick:connect(onClicked)

end
end
end
end
end
end

Report Abuse
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
18 May 2013 03:33 PM
function onClicked()
print("Hello World!")

if script.Parent.IsOff == true
then

script.Parent.IsOn.Value = true
script.Parent.IsOff.Value = false

if script.Parent.IsOff == false
then

script.Parent.IsOn.Value = false -------Isn't this turning it 'off'?
script.Parent.IsOff.Value = true

if script.Parent.IsOn.Value == true -------It turned it off above...^
then

script.Parent.Parent.CealingLight1.Light1.SpotLight.Enabled = true
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = true
wait(1)
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = false

while true do
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = false
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = true
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = false

if script.Parent.IsOn == true then
script.Parent.Parent.CealingLight1.Light1.SpotLight.Enabled = false
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = false
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enable = false



script.Parent.ClickDetector.MouseClick:connect(onClicked)

end
end
end
end
end
end
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
18 May 2013 03:35 PM
Without looking through it fully, here's one big problem: It won't connect, because the connection line is inside the function.

function onClicked()
print("Hello World!")

if script.Parent.IsOff == true
then

script.Parent.IsOn.Value = true
script.Parent.IsOff.Value = false

if script.Parent.IsOff == false
then

script.Parent.IsOn.Value = false
script.Parent.IsOff.Value = true

if script.Parent.IsOn.Value == true
then

script.Parent.Parent.CealingLight1.Light1.SpotLight.Enabled = true
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = true
wait(1)
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = false

while true do
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = false
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = true
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = false

if script.Parent.IsOn == true then
script.Parent.Parent.CealingLight1.Light1.SpotLight.Enabled = false
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = false
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enable = false

end
end
end
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Might have a problem somewhere else, though. Didn't look through it.

-JB
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 03:36 PM
Um....
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 03:37 PM
Thank L2000, I will see if that works.
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 03:43 PM
@zackeryjerrypowers, No what it was supposed to do is if you click it while it's on then it turns it off, if you click it while it's off then it turns it on.
Report Abuse
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
18 May 2013 03:44 PM
Alrighty. :|

∂◊и'₮ サ∆₮∑ ◊и ₮サ∑ ㄅⅰббㄚ
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 03:44 PM
This is what I have now:



function onClicked()
print("Hello World!")

if script.Parent.IsOff == true
then

script.Parent.IsOn.Value = true
script.Parent.IsOff.Value = false

if script.Parent.IsOff == false
then

script.Parent.IsOn.Value = false
script.Parent.IsOff.Value = true

if script.Parent.IsOn.Value == true
then

script.Parent.Parent.CealingLight1.Light1.SpotLight.Enabled = true
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = true
wait(1)
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = false

while true do
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = false
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = true
wait(0.1)
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enabled = false

if script.Parent.IsOn == true then
script.Parent.Parent.CealingLight1.Light1.SpotLight.Enabled = false
script.Parent.Parent.CealingLight1.Light2.SpotLight.Enabled = false
script.Parent.Parent.CealingLight1.Light2.Sparkles.Enable = false

end
end
end
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 03:56 PM
Still doesn't work.
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 04:09 PM
B1
Report Abuse
shooter06 is not online. shooter06
Joined: 13 Jan 2011
Total Posts: 7443
18 May 2013 04:10 PM
[ Content Deleted ]
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
18 May 2013 04:14 PM
1) Spell "ceiling" correctly.
2) You don't need an "IsOn" and "IsOff" variable, just one will do.
3) Your ends are in the wrong place
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 04:22 PM
@shooter, Output won't tell me the error.
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 04:27 PM
I got this now, same problem. Output just says "Hello World!" every time I click switch.



function onClicked()
print("Hello World!")

if script.Parent.IsOff == true
then

script.Parent.IsOff.Value = false

if script.Parent.IsOff == false
then

script.Parent.IsOff.Value = true

end

if script.Parent.IsOff.Value == false
then

script.Parent.Parent.CeilingLight1.Light1.SpotLight.Enabled = true
wait(0.1)
script.Parent.Parent.CeilingLight1.Light2.SpotLight.Enabled = true
wait(1)
script.Parent.Parent.CeilingLight1.Light2.SpotLight.Enabled = false

while true do
wait(0.1)
script.Parent.Parent.CeilingLight1.Light2.Sparkles.Enabled = false
wait(0.1)
script.Parent.Parent.CeilingLight1.Light2.Sparkles.Enabled = true
wait(0.1)
script.Parent.Parent.CeilingLight1.Light2.Sparkles.Enabled = false

if script.Parent.IsOff == true then
script.Parent.Parent.CeilingLight1.Light1.SpotLight.Enabled = false
script.Parent.Parent.CeilingLight1.Light2.SpotLight.Enabled = false
script.Parent.Parent.CeilingLight1.Light2.Sparkles.Enable = false

end
end
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Report Abuse
ZekeZakKaz is not online. ZekeZakKaz
Joined: 31 Mar 2012
Total Posts: 13907
18 May 2013 04:34 PM
[ Content Deleted ]
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 04:39 PM
@Zeke, I get this:


16:38:59.597 - attempt to call a nil value
16:38:59.609 - Disconnected event because of exception
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
18 May 2013 04:40 PM
@Zeke: That'd make it error.


local on = false;
local lights = script.Parent.Parent.CeilingLight1;

local function setLight(n, o)
lights["Light"..n].SpotLight.Enabled = o;
end

local function setSparkes(n, o)
lights["Light"..n].Sparkles.Enabled = o;

script.Parent.ClickDetector.MouseClick:connect(function ()
on = not on;
if (on) then
setLight(1, true);
wait(0.1);
setLight(2, true);
wait(1);
setLight(2, false);
repeat
wait(0.1);
setSparkles(2, false);
wait(0.1);
setSparkles(2, true);
wait(0.1);
setSparkles(2, false);
until (not on);
setLight(1, false);
setLight(2, false);
setSparkles(2, false);
end
end);
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 04:45 PM
@Dr01d3k4
Didn't do anything.
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
18 May 2013 04:59 PM
local on = false
function onClicked()
-- Three lights
on = not on

if on then
script.Parent.Parent.CeilingLight1.Light1.SpotLight.Enabled = true
wait(0.1)
script.Parent.Parent.CeilingLight1.Light2.SpotLight.Enabled = true
wait(1)
script.Parent.Parent.CeilingLight1.Light2.SpotLight.Enabled = false
end

while on and wait() do
script.Parent.Parent.CeilingLight1.Light2.Sparkles.Enabled = false
wait(0.1)
script.Parent.Parent.CeilingLight1.Light2.Sparkles.Enabled = true
wait(0.1)
script.Parent.Parent.CeilingLight1.Light2.Sparkles.Enabled = false
end

while not on and wait() do
script.Parent.Parent.CeilingLight1.Light1.SpotLight.Enabled = false
script.Parent.Parent.CeilingLight1.Light2.SpotLight.Enabled = false
script.Parent.Parent.CeilingLight1.Light2.Sparkles.Enable = false
end

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

~ Linguam latinam est optimum ~
Report Abuse
shortPinman is not online. shortPinman
Joined: 02 Apr 2010
Total Posts: 16303
18 May 2013 05:02 PM
@dekkonot, Thanks it worked.
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
18 May 2013 05:02 PM
You are welcome.

~ Linguam latinam est optimum ~
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