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 won't work-Help?

Previous Thread :: Next Thread 
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 02:23 PM
Hello, I'm working on a certain project for a theatre-like light. I'm getting stuck on making the button go transparent...

My main idea with this script is that is would(In-order):
1. Make this button Transparent
2. Make lightbeam visible
3. Make the other button visible

I'm still on step one, yes, this may be simple... I'm teaching myself how to script :3

Right now the script says:

function onClicked ()
script.Parent.Transparency= 1
end

The script and ClickDetector and Mesh is in the button that I want transparent.
Output says nothing about it not working, yet I run the game and click it and nothing...
In my research, it should work...

If you won't help, don't post. Don't tell me to consult the Wiki, I already did.
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
07 Aug 2011 02:26 PM
script.Parent.ClickDetector.Clicked:connect(onClicked)
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 02:29 PM
Hm. Of course, I looked at another model and it wasn't in there...

Now, where would this go? in the line right after function?
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
07 Aug 2011 02:31 PM
It can go before or after, but after is probably better.
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 02:38 PM
Figured, just checking.

Let me try...

ok, now it says:

function script.Parent.ClickDetector.Clicked:connect(onClicked)
script.Parent.Transparency= 1
end

The output says:
Clicked is not a valid member of ClickDetector

Either it's your error or I placed it wrong...
Report Abuse
boynedmaster is not online. boynedmaster
Joined: 28 Jun 2008
Total Posts: 9735
07 Aug 2011 02:39 PM
function onClicked()
script.Parent.Transparency= 1
end


script.Parent.ClickDector.MouseClick:connect(onClicked)
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
07 Aug 2011 02:40 PM
Sorry, I was being absent-minded. There is no Clicked event in ClickDetectors.
Report Abuse
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
07 Aug 2011 02:42 PM
It's something like this you want?

b = script.Parent
function onClicked()
b.Transparency = 1
end
b.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 02:43 PM
Output:

ClickDector is not a valid member of Part


I replaced the whole script with what you said, boyn.
Report Abuse
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
07 Aug 2011 02:44 PM
it's ClickDetector
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 02:45 PM
I copy-pasted...
Report Abuse
Ultraw is not online. Ultraw
Joined: 20 Nov 2010
Total Posts: 6575
07 Aug 2011 02:46 PM
function onClicked()
script.Parent.Transparency= 1
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
boynedmaster is not online. boynedmaster
Joined: 28 Jun 2008
Total Posts: 9735
07 Aug 2011 02:46 PM
Sorry. Change ClickDector to ClickDetector in connection line.
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 02:47 PM
Ok... Output says nothing, and when I press play and click it, I get nothing.

Script:

function onClicked()
script.Parent.Transparency= 1
end


script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
boynedmaster is not online. boynedmaster
Joined: 28 Jun 2008
Total Posts: 9735
07 Aug 2011 02:48 PM

function onClicked()
wait()
script.Parent.Transparency= 1
end


script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 02:49 PM
Still nothing...
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 02:59 PM
Oh... I see.... You gotta go into Tools>Test>Play Solo
Well, I may need help on the second part... won't be for about 5 minutes.
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 03:14 PM
-Ok, here I am again...

-Script:

function onClicked()
wait()
script.Parent.Transparency= 1
end

script.Parent.Parent.LightBeam.Transparency= 0.6
end

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

-Output:

Workspace.Light.On.Script:7: 'eof' expected near 'end'

--Add < and > around eof... Some anti-HTML thing for posting...--
-I'm not sure if the last line is supposed to be either before or after everything in the script...
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 03:23 PM
And I don't know what < eof > is...
Report Abuse
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
07 Aug 2011 03:26 PM
function onClicked()
wait()
script.Parent.Transparency= 1
script.Parent.Parent.LightBeam.Transparency= 0.6
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

this is the script your only supposen to use an end when theres a function or a line with if ... then

Report Abuse
boynedmaster is not online. boynedmaster
Joined: 28 Jun 2008
Total Posts: 9735
07 Aug 2011 03:28 PM
function onClicked()
wait()
script.Parent.Transparency= 1
script.Parent.Parent.LightBeam.Transparency= 0.6
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 03:35 PM
Ok, then I want

script.Parent.Parent.Off.Transparency= 0

added, so it would be :

function onClicked()
wait()
script.Parent.Transparency= 1
script.Parent.Parent.LightBeam.Transparency= 0.6
script.Parent.Parent.Off.Transparency= 0
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)


Correct?
See, this is what teaches me, being able to ask and stuff if it's complicated...
The wiki only give me the Mc Donald's Order way, "Step 1: Bun Down; 2. Burger; 3.--and so on..." Where if I were to keep doing the same thing, it'd be fine cause I'd memorize it...
But I want to build from scratch! :D
Report Abuse
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
07 Aug 2011 03:36 PM
Correct :D
Report Abuse
DarthVader901 is not online. DarthVader901
Joined: 21 Jul 2009
Total Posts: 254
07 Aug 2011 03:42 PM
See, I think I learned how to make click objects work!

And who says I need the stupid wiki now? Hm? HA! lol?


And, of course, for the Off switch, I just need to change stuff for it to work.


I'll have to improve this by making the switch actually move, but I'll save that for later.

And for lava I'd have said it was

function OnTouch
Humanoid.Health: 0
end

But now I'd make it

function OnTouch
Humanoid.Health= 0
end

I think I'm wrong, but what ever. I'll have to research it a bit...
Report Abuse
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
07 Aug 2011 03:45 PM
yeah this paart is a bit of harder this should be

function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h ~=nil) then
h.Health = 0
end
end
script.Parent.Touched:connect(onTouched)
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