darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
I've been working on this Self Deploying cover and at a certain point when i touched the "open" Button it spammed my output with "Attempt to call a nil value" Probably because i made for each part a seperate script (Easyer for me to overlook, Im still an amature scripter) and Because of that (4 Script for each button (Open/Close) I probably wont find the problem. Im sure noone will bother to see into this but if you would i'd be very grateful.
http://www.roblox.com/Self-Deploying-Cover-WIP-Cant-fix-it-item?id=45058614 |
|
|
|
darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
Well i would want to but there are eight scripts, wich are all slightly different :P
|
|
KrammyJoin Date: 2008-06-29 Post Count: 3599 |
Number the script 1 to 8, look in the output for the script name then post that script here. |
|
KrammyJoin Date: 2008-06-29 Post Count: 3599 |
Number the scripts* |
|
darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
Ill just post them all :3
First off, the Layout Workspace>>>DCover1>>>Value/Close/Open/Side1/Side1b/Side2/Side2b
Value = 1
Close>>>Scripts; Side1,Side1b,Side2,Side2b----ClickDetetctor
Open>>>Scripts; Side1,Side1b,Side2,Side2b----ClickDetector
Now the script's
ALL BELOW IS PART OF THE CLOSE BUTTON
Side1
Side1 = game.Workspace.DCover1.Side1
Value = script.Parent.Parent.Value
if Value == 0 then
function onClicked()
Value.Value = 1
wait(1.3)
for i = 1, 40, 1 do
Side1.CFrame = Side1.CFrame * CFrame.new(-0.05, 0, 0)
wait()
end
end
else if Value == 1 then
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Side1b
Side1 = script.Parent.Parent.Side1b
Value = script.Parent.Parent.Value
if Value == 0 then
function onClicked()
Side1.Transparency = 0
for i = 1, 35, 1 do
Side1.CFrame = Side1.CFrame * CFrame.new(-0.05, 0, 0)
wait()
end
end
else if Value == 1 then
end
Side1.Transparency = 1
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Side2
Side2 = game.Workspace.DCover1.Side2
Value = script.Parent.Parent.Value
if Value == 0 then
function onClicked()
wait(1.3)
for i = 1, 40, 1 do
Side2.CFrame = Side2.CFrame * CFrame.new(0.05, 0, 0)
wait()
end
end
else if Value == 1 then
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Side2b
Side2 = script.Parent.Parent.Side2b
Value = script.Parent.Parent.Value
if Value == 0 then
function onClicked()
Side2.Transparency = 0
for i = 1, 35, 1 do
Side2.CFrame = Side2.CFrame * CFrame.new(0.05, 0, 0)
wait()
end
end
else if Value == 1 then
end
Side2.Transparency = 1
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
ALL BELOW IS PART OF THE OPEN BUTTON
Side1
Side1 = script.Parent.Parent.Side1
Value = script.Parent.Parent.Value
if Value == 1 then
function onClicked()
Value.Value = 0
for i = 1, 40, 1 do
Side1.CFrame = Side1.CFrame * CFrame.new(0.05, 0, 0)
wait()
end
end
else if Value == 0 then
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Side1b
Side1 = script.Parent.Parent.Side1b
Value = script.Parent.Parent.Value
if Value == 1 then
function onClicked()
wait(1.3)
Side1.Transparency = 0
for i = 1, 35, 1 do
Side1.CFrame = Side1.CFrame * CFrame.new(0.05, 0, 0)
wait()
end
end
else if Value == 0 then
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Side2
Side2 = script.Parent.Parent.Side2
Value = script.Parent.Parent.Value
if Value == 1 then
function onClicked()
for i = 1, 40, 1 do
Side2.CFrame = Side2.CFrame * CFrame.new(-0.05, 0, 0)
wait()
end
end
else if Value == 0 then
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Side2b
Side2 = script.Parent.Parent.Side2b
Value = script.Parent.Parent.Value
if Value == 1 then
function onClicked()
wait(1.3)
Side2.Transparency = 0
for i = 1, 35, 1 do
Side2.CFrame = Side2.CFrame * CFrame.new(-0.05, 0, 0)
wait()
end
end
else if Value == 0 then
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Now the output keeps telling me "Attempt to call a nil value" Thingy. I got the message after i put the Value = script.Parent.Parent.Value
if Value == 1 then Parts into the scripts
|
|
darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
Side1 Side1b Side2 Side2b are bricks in the model DCover1
Anyother of the above behind Open or close are the scripts
|
|
|
Dark add this to all scripts....
env = getfenv();
setfenv(1, setmetatable({},{
__index = function(t, k, v)
return env[k] or error(k.."is a nil value.")
end
})) |
|
darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
Above or below the function? |
|
|
My bad do this one... It tells you what variable is nil. Add it at top of scripts. Than run them and look at the output.
env = getfenv();
setfenv(1, setmetatable({},{__index = function(t, k, v) return env[k] or error(k.." is a nil value."); end}))
print(x) --> x is a nil value |
|
darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
Hmm it still doesn't work, Output now give's me;
Fri Jan 28 22:44:54 2011 - Running Script 'Side1'
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Open.Side1:2: x is a nil value.
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Open.Side1, line 2 Workspace.DCover1.Open.Side1, line 3 stack end
Fri Jan 28 22:44:54 2011 - Running Script 'Side2'
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Open.Side2:2: x is a nil value.
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Open.Side2, line 2 Workspace.DCover1.Open.Side2, line 3 stack end
Fri Jan 28 22:44:54 2011 - Running Script 'Side1b'
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Open.Side1b:2: x is a nil value.
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Open.Side1b, line 2 Workspace.DCover1.Open.Side1b, line 3 stack end
Fri Jan 28 22:44:54 2011 - Running Script 'Side2b'
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Open.Side2b:2: x is a nil value.
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Open.Side2b, line 2 Workspace.DCover1.Open.Side2b, line 3 stack end
Fri Jan 28 22:44:54 2011 - Running Script 'Side1'
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Close.Side1:2: x is a nil value.
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Close.Side1, line 2 Workspace.DCover1.Close.Side1, line 3 stack end
Fri Jan 28 22:44:54 2011 - Running Script 'Side2'
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Close.Side2:2: x is a nil value.
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Close.Side2, line 2 Workspace.DCover1.Close.Side2, line 3 stack end
Fri Jan 28 22:44:54 2011 - Running Script 'Side1b'
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Close.Side1b:2: x is a nil value.
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Close.Side1b, line 2 Workspace.DCover1.Close.Side1b, line 3 stack end
Fri Jan 28 22:44:54 2011 - Running Script 'Side2b'
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Close.Side2b:2: x is a nil value.
Fri Jan 28 22:44:54 2011 - Workspace.DCover1.Close.Side2b, line 2 Workspace.DCover1.Close.Side2b, line 3 stack end |
|
darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
When i just use the button as it is (broken :3) The output tells me this
Fri Jan 28 22:48:35 2011 - attempt to call a nil value
Fri Jan 28 22:48:35 2011 -
Fri Jan 28 22:48:35 2011 - Disconnected event because of exception
Fri Jan 28 22:48:35 2011 - attempt to call a nil value
Fri Jan 28 22:48:35 2011 -
Fri Jan 28 22:48:35 2011 - Disconnected event because of exception
Fri Jan 28 22:48:35 2011 - attempt to call a nil value
Fri Jan 28 22:48:35 2011 -
Fri Jan 28 22:48:35 2011 - Disconnected event because of exception
Fri Jan 28 22:48:35 2011 - attempt to call a nil value
Fri Jan 28 22:48:35 2011 -
Fri Jan 28 22:48:35 2011 - Disconnected event because of exception |
|
|
Obviously whatever you're calling x on in your script is a nil value.
Workspace.DCover1.Close.Side1:2: x is a nil value.
----------------------------------------^^^^^^^^^^
x is a nil value can you not read.
Its the x variable on line 2. Of the scripts
["Side1", "Side2", "Side1b", "Side2b"]
|
|
darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
With the Script ENET just put it gives me the output 2 posts above. |
|
darkboedaJoin Date: 2009-04-26 Post Count: 3724 |
If it's pointing out to line two then something is wrong with "Value = script.Parent.Parent.Value" |
|
|
My bad, you accidentally included print(x) which was an example. Dude that's my bad do this one lol at top of all scripts....
env = getfenv();
setfenv(1, setmetatable({},{__index = function(t, k, v) return env[k] or error(k.." is a nil value."); end}))
|
|