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: Little issue with my hood/bonnet script

Previous Thread :: Next Thread 
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 02:44 PM
Sorry, this is like the fourth post I've made about the car I'm making, but when I comes to scripting, I'm pretty useless.

From the script you'll probably be able to tell what I'm trying to do.
The output says something about a nil value.

---Bonnet[DOWN]

function OnClick()
script.Parent.Transparency = 1
script.Parent.CanCollide = false
script.Parent.Parent.Bonnet[UP].Transparency = 0
script.Parent.Parent.Bonnet[UP].CanCollide = true
end

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

---Bonnet[UP]

function OnClick()
script.Parent.Transparency = 1
script.Parent.CanCollide = false
script.Parent.Parent.Bonnet[DOWN].Transparency = 0
script.Parent.Parent.Bonnet[DOWN].CanCollide = true
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 02:47 PM
What have I done wrong?

It starts off with Bonnet[UP] transparent and it's CanCollide is false, and Bonnet[DOWN] is the complete opposite.

I'm trying to make it so when you click the visible one it changes to the other, so it looks like you're opening/closing it.
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
27 Jun 2012 02:49 PM
Your connect line doesn't match the function name.

"onClicked" vs "OnClick"
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 02:50 PM
Once again, you've saved my small brain.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 02:53 PM
Wait, it still says 'attempt to call a nil value'.

Wat do?
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
27 Jun 2012 02:54 PM
What line?
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 02:55 PM
It doesn't say, just says 'attempt to call a nil value'.
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
27 Jun 2012 02:59 PM
Are the actual parts called Bonnet[Down] and Button[UP]?
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 03:01 PM
Yeah, the one where it is open is 'Bonnet[UP]'
The one where it is closed is 'Bonnet[DOWN]'
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
27 Jun 2012 03:04 PM
Take off the brackets because the script thinks its.
Bonnet.UP and Bonnet.DOWN with UP and DOWN being the children or Bonnet.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 03:04 PM
Is there an actual reason for the output print or is ROBLOX having a dumb moment?
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 03:05 PM
Ok, I'll try that
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
27 Jun 2012 03:06 PM
Then just edit the script and stuff
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 03:07 PM
Nope, still comes up with the same error...
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
27 Jun 2012 03:08 PM
Did you change the part name AND fix the script?
If so copy the exact line that it says.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 03:10 PM
Yup, changed the part and the script :/

Is it an issue that the open bonnet is cframed?
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 03:11 PM
Copy the exact line that what says?
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
27 Jun 2012 03:11 PM
The output and it doesn't matter if it's C-Frame.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 03:12 PM
The output says

attempt to call a nil value
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
27 Jun 2012 03:14 PM
And this script is within the button you are supposed to click right?
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
27 Jun 2012 03:16 PM
Yes, Bonnet1 (I renamed them with numbers) has the script that makes Bonnet2 invisible, and vice-versa.
Report Abuse
BladzofChaos70 is not online. BladzofChaos70
Joined: 27 Sep 2008
Total Posts: 2550
27 Jun 2012 03:19 PM
What's the exact new script you've got? Did you change the values in the scripts from "Bonnet[UP]" to "Bonnet1" like their new names are?
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
27 Jun 2012 03:20 PM
Lol guys

Bonnet["UP"]

Anything in the brackets should be quoted
Report Abuse
lucas668 is not online. lucas668
Joined: 18 Jun 2008
Total Posts: 6183
27 Jun 2012 03:21 PM
I think we'd need the model to know how the "environment" of the script is set up, AKA where it's at in relation to everything being called.
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
27 Jun 2012 03:23 PM
If that's too hard to understand..

---Bonnet[DOWN]

function OnClick()
script.Parent.Transparency = 1
script.Parent.CanCollide = false
script.Parent.Parent.Bonnet["UP"].Transparency = 0
script.Parent.Parent.Bonnet["UP"].CanCollide = true
end

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

---Bonnet[UP]

function OnClick()
script.Parent.Transparency = 1
script.Parent.CanCollide = false
script.Parent.Parent.Bonnet["DOWN"].Transparency = 0
script.Parent.Parent.Bonnet["DOWN"].CanCollide = true
end

script.Parent.ClickDetector.MouseClick:connect(OnClick)
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