JuJuTiaJoin Date: 2008-05-24 Post Count: 37 |
Make a brick that doesn't let anything through on one side (bricks, players, zombies, ect...) but lets things through on the other side? |
|
1waffle1Join Date: 2007-10-16 Post Count: 16381 |
1 way door. A button door. |
|
ArinthTop 100 PosterJoin Date: 2007-05-24 Post Count: 1009 |
Yup theres one at my place, If you need an example. |
|
FlashJoeWTop 100 PosterJoin Date: 2007-12-24 Post Count: 4886 |
my 1 way door... |
|
randomrobotTop 100 PosterJoin Date: 2007-07-02 Post Count: 11636 |
You people are so simple, lol
If you are making a house or something like that, add this script to the floor:
function onTouch(hit)
h = hit.Parent:findFirstChild("Humanoid")
if h==nil then return "not a living object"
else
if h.Parent:findFirstChild("Went through door")==nil then
v = Instance.new("IntValue")
v.Name = "Went through door"
v.Parent = h.Parent
else return "already went through door"
end
end
end
script.Parent.Touched:connect(onTouch)
This is the door script:
door = script.Parent
debounce = true
function onTouch(hit)
if debounce==true then debounce==false
h = hit.Parent:findFirstChild("Humanoid")
if h==nil then return "not a living object"
else
if h.Parent:findFirstChild("Went through door")==nil then
door.CanCollide = false
door.Transparency = 0.5
wait(4)
door.CanCollide = true
door.Transparency = 0
else return "already went through door"
end
end
debounce = true
end
end |
|
Dr01d3k4Join Date: 2007-10-11 Post Count: 17916 |
Fixed :)
function onTouched(hit)
local h = hit.Parent:findFirstChild("Humanoid")
if (h ~= nil) then
if (h.Parent:findFirstChild("Went through door") ~= nil) then return end
v = Instance.new("IntValue")
v.Name = "Went through door"
v.Parent = h.Parent
end
end
script.Parent.Touched:connect(onTouch)
This is the door script:
door = script.Parent
debounce = false
function onTouched(hit)
local h = hit.Parent:findFirstChild("Humanoid")
if (h ~= nil) then
if (h.Parent:findFirstChild("Went through door") ~= nil) then return end
if (debounce == false) then
debounce = true
door.CanCollide = false
door.Transparency = 0.5
wait(4)
door.CanCollide = true
door.Transparency = 0
debounce = false
end
end
end
script.Parent.Touched:connect(onTouched) |
|
randomrobotTop 100 PosterJoin Date: 2007-07-02 Post Count: 11636 |
I bet you didn't even test mine. |
|
Dr01d3k4Join Date: 2007-10-11 Post Count: 17916 |
I didn't and I noticed mistakes. If you use "return", you don't need "else" and I don't know if you can do this:
return "not a living object" |
|
randomrobotTop 100 PosterJoin Date: 2007-07-02 Post Count: 11636 |
Whoops, I forgot the connection line. That was the problem. |
|
randomrobotTop 100 PosterJoin Date: 2007-07-02 Post Count: 11636 |
That was the ONLY problem. |
|
randomrobotTop 100 PosterJoin Date: 2007-07-02 Post Count: 11636 |
Fix:
door script:
door = script.Parent
debounce = true
function onTouch(hit)
if debounce==true then debounce=false
h = hit.Parent:findFirstChild("Humanoid")
if h==nil then return "not a living object"
else
if h.Parent:findFirstChild("Went through door")==nil then
door.CanCollide = false
door.Transparency = 0.5
wait(1)
door.CanCollide = true
door.Transparency = 0
else return "already went through door"
end
end
debounce = true
end
end
script.Parent.Touched:connect(onTouch)
floor script:
function onTouch(hit)
h = hit.Parent:findFirstChild("Humanoid")
if h==nil then return "not a living object"
else
if h.Parent:findFirstChild("Went through door")==nil then
v = Instance.new("IntValue")
v.Name = "Went through door"
v.Parent = h.Parent
else return "already went through door"
end
end
end
script.Parent.Touched:connect(onTouch)
|
|
Dr01d3k4Join Date: 2007-10-11 Post Count: 17916 |
If you use return, you don't use else. Another problem. E.G.
function onTouched(hit)
local h = hit.Parent:findFirstChild("Humanoid")
if (h == nil) then return end
h.Health = h.Health -100
end
script.Parent.Touched:connect(onTouched) |
|
randomrobotTop 100 PosterJoin Date: 2007-07-02 Post Count: 11636 |
No, you're wrong. My fixed scripts work. |
|
Dr01d3k4Join Date: 2007-10-11 Post Count: 17916 |
So do mine. |
|
randomrobotTop 100 PosterJoin Date: 2007-07-02 Post Count: 11636 |
Mine look awesomer >:O lol, jk |
|