|
| 06 Dec 2011 10:02 PM |
So this script is in a brick that is grouped with a bunch of other bricks. It's supposed to make it look like a door opened then closed, but really different bricks just changed visibility and transparency. The script does not do anything and has no output. I'm new to pairs so I'm pretty sure the problem lies in that area. Could I get some help please?
mod = script.Parent.Parent -- The model everything is in
cd = mod.cd cdna = mod.cdna cdnb = mod.cdnb cdad = cdna.Decal cdbd = cdnb.Decal od = mod.od odna = mod.odna odnb = mod.odnb odad = odna.Decal odbd = odnb.Decal
t = {cd,cdna,cdad,cdbd,od,odna,odad,odbd}
function openclose(part) if part.Parent:findFirstChild("Humanoid") and cd.Transparency == 1 then for i,v in pairs(t) do if i.ClassName == "Part" then i.CanCollide = false end i.Transparency = 1 end wait(3) for i,v in pairs(t) do if i.ClassName == "Part" then i.CanCollide = true end i.Transparency = 0 end end end
script.Parent.Touched:connect(openclose) |
|
|
| Report Abuse |
|
|
|
| 06 Dec 2011 10:07 PM |
Actually I figured out why it's not doing anything, now it has an output: Workspace.Model.cd.Script:19: attempt to index local 'i' (a number value)
mod = script.Parent.Parent -- The model everything is in
cd = mod.cd cdna = mod.cdna cdnb = mod.cdnb cdad = cdna.Decal cdbd = cdnb.Decal od = mod.od odna = mod.odna odnb = mod.odnb odad = odna.Decal odbd = odnb.Decal
t = {cd,cdna,cdad,cdbd,od,odna,odad,odbd}
function openclose(part) if part.Parent:findFirstChild("Humanoid") and cd.Transparency == 0 then --That should have been 0 for i,v in pairs(t) do if i.ClassName == "Part" then i.CanCollide = false end i.Transparency = 1 end wait(3) for i,v in pairs(t) do if i.ClassName == "Part" then i.CanCollide = true end i.Transparency = 0 end end end
script.Parent.Touched:connect(openclose)
|
|
|
| Report Abuse |
|
|
|
| 06 Dec 2011 10:09 PM |
| Okay never mind, I figured it out :D |
|
|
| Report Abuse |
|
|
| |
|