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: I need help with this script.

Previous Thread :: Next Thread 
Dino77 is not online. Dino77
Joined: 06 Apr 2008
Total Posts: 748
05 Aug 2011 07:22 PM
I've tried to make a script where you click the script's parent, and it makes another child (Light) within that parent unanchore when clicked, then if it is clicked again, for it to anchore, then unanchore (ect.) I'm confused though, and I don't know where I messed up:

Light = script.Parent.Light

function OnClicked()

Light.Anchored = false

else

Light.Anchored = true

Fanswitch.ClickDetector.MouseClick:connect(OnClicked)
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
05 Aug 2011 08:08 PM
Light = script.Parent.Light

function OnClicked()

Light.Anchored = false

else

Light.Anchored = true

script.Parent.ClickDetector.MouseClick:connect(OnClicked)
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
05 Aug 2011 08:10 PM
Light = script.Parent.Light
function onClicked()
if Light.Anchored == false then
Light.Anchored = true
elseif Light.Anchored == true then
Light.Anchored = false
end
end
scirpt.Parent.ClickDetector.MouseClick:connect(onClicked)

(:
Report Abuse
Duderino99 is not online. Duderino99
Joined: 04 Aug 2009
Total Posts: 320
05 Aug 2011 08:10 PM
you never have a first "if" else is like a last resort kind off thing to think about the computer is reading this going "What am i suppose to do before having to unanchor "light"?"

so working script

Light = script.Parent.Light

function OnClicked()

if Light.Anchored == true then

Light.Anchored = false
end

else
Light.Anchored = true

Script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
Duderino99 is not online. Duderino99
Joined: 04 Aug 2009
Total Posts: 320
05 Aug 2011 08:11 PM
*edit*


else
Light.Anchored = true
end


*oops*
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