|
| 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
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 07 Aug 2011 02:26 PM |
| script.Parent.ClickDetector.Clicked:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 07 Aug 2011 02:39 PM |
function onClicked() script.Parent.Transparency= 1 end
script.Parent.ClickDector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
| |
|
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 |
|
|
|
| 07 Aug 2011 02:46 PM |
| Sorry. Change ClickDector to ClickDetector in connection line. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 07 Aug 2011 02:48 PM |
function onClicked() wait() script.Parent.Transparency= 1 end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 07 Aug 2011 03:23 PM |
| And I don't know what < eof > is... |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|