BakerleyJoin Date: 2009-10-12 Post Count: 12011 |
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 :) |
|
BakerleyJoin Date: 2009-10-12 Post Count: 12011 |
bump |
|
|
You got your capitals and lowers correct?
I only scanned through. |
|
|
1) what is da script meant to do
2) any output |
|
BakerleyJoin Date: 2009-10-12 Post Count: 12011 |
No output.
Come to my place, I'll show you. |
|
BakerleyJoin Date: 2009-10-12 Post Count: 12011 |
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 |
|
BakerleyJoin Date: 2009-10-12 Post Count: 12011 |
I suggest you read the end of my first post. :D |
|
|
Wait, isn't the word "script" meant to be changed to "Script" a capital "S"? |
|
|
^
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
script is script, to refer to itself.
Just like workspace is workspace, in reference to itself. |
|
BakerleyJoin Date: 2009-10-12 Post Count: 12011 |
Nope.
I fixed this with a debounce and merged some scripts together, the script is working perfectly now :D |
|
|
How did you use the tab on the forum?
Or how did you indent on the forums? |
|
|
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 |
|
|
oooo annnnnd
script.Parent.Touched:connect(onTouch) |
|
BakerleyJoin Date: 2009-10-12 Post Count: 12011 |
Pokemon, it automatically does it
That's why some parts were missed out |
|
|
|
wouldnt my way work alot easyer? :p
bob -- maker of scripty thingies for people who make life complicated lol ;D |
|
|
@bob
I think it would be better to use a table.
Users = {"pokemon771", "Telamon"}
|
|