|
| 30 Nov 2011 12:58 PM |
Okay, so I'm making this super awesome card/pass/hand/sensor door And I have a hand sensor that I made Here's the first script:
Activate = script.Parent.Activator
local users = {"rossb654mail","Player"} --you can add more player's here
function onTouched(hit) for _, username in ipairs(users) do if hit.Parent.Name:lower() == username:lower() then
Activate.Disabled = false wait(0.01) Activate.Disabled = true end end end
script.Parent.Touched:connect(onTouched)
Now, you're probably thinking "Hmm? what is Activate?" Well, that is another script. I activate other scripts to test that it works, then I merge into one. Here's the other script:
light = script.Parent.Parent.Light door = script.Parent.Parent.Door sensor = script.Parent
script.Parent.Script.Disabled = true light.BrickColor = BrickColor.new(1009) sensor.BrickColor = BrickColor.new(1009) wait(1) light.BrickColor = BrickColor.new(1020) sensor.BrickColor = BrickColor.new(1020) for i = 1, 30 do wait(0.01) door.CFrame = door.CFrame * CFrame.new(0.2,0,0) end
wait(3)
for i = 1, 30 do wait(0.01) door.CFrame = door.CFrame * CFrame.new(-0.2,0,0) end
light.BrickColor = BrickColor.new(1004) sensor.BrickColor = BrickColor.new(194) script.Parent.Script.Disabled = false
Okay, so when this activates, the script is stuck. The "light" and "sensor" are stuck on New Yeller. [That's the 1009 Colour Code in this script] Why is this happening? I was thinking that you can't put a wait in a script without a function But you cannot use while, looped, onTouched or onClicked on this sort of thing that's meant to activate when the correct person touches the sensor
Sorry if this is confusing XD
Please help :) |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Dec 2011 11:36 AM |
You got your capitals and lowers correct? I only scanned through. |
|
|
| Report Abuse |
|
|
|
| 01 Dec 2011 11:47 AM |
1) what is da script meant to do 2) any output |
|
|
| Report Abuse |
|
|
|
| 01 Dec 2011 12:24 PM |
No output. Come to my place, I'll show you. |
|
|
| Report Abuse |
|
|
|
| 01 Dec 2011 12:26 PM |
Oh snap, he's offline.
The script, roughly:
Someone touches the sensor If their name is in permission, the light goes yellow to process [Just to make it look better XD] Then it goes green. Door slides open. Wait 3/4 seconds Door closes. Light turns red.
Where I said the light changes colour, so does the sensor, but the sensor is grey so when the light goes red, sensor goes grey. :D |
|
|
| Report Abuse |
|
|
|
| 01 Dec 2011 12:27 PM |
| I suggest you read the end of my first post. :D |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2011 03:46 PM |
| Wait, isn't the word "script" meant to be changed to "Script" a capital "S"? |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2011 03:48 PM |
^ NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
script is script, to refer to itself. Just like workspace is workspace, in reference to itself. |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2011 03:48 PM |
Nope. I fixed this with a debounce and merged some scripts together, the script is working perfectly now :D |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2011 03:49 PM |
How did you use the tab on the forum? Or how did you indent on the forums? |
|
|
| Report Abuse |
|
|
bob354293
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 2609 |
|
|
| 13 Dec 2011 03:49 PM |
wouldnt it be easyer to do;
function onTouched(hit) if hit.Parent.Name == ("bob") or hit.Parent.Name == ("Vipdude007") then door open/ close thingy here and anything else else end end ??
people make scripting so difficult ...!
bob -- maker of scripty thingies for people who make life complicated lol ;D |
|
|
| Report Abuse |
|
|
bob354293
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 2609 |
|
|
| 13 Dec 2011 03:50 PM |
oooo annnnnd
script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2011 03:50 PM |
Pokemon, it automatically does it That's why some parts were missed out |
|
|
| Report Abuse |
|
|
| |
|
bob354293
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 2609 |
|
|
| 13 Dec 2011 03:52 PM |
wouldnt my way work alot easyer? :p
bob -- maker of scripty thingies for people who make life complicated lol ;D |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2011 03:56 PM |
@bob I think it would be better to use a table. Users = {"pokemon771", "Telamon"}
|
|
|
| Report Abuse |
|
|