05-22-2011, 09:21 PM
(This post was last modified: 05-22-2011, 09:25 PM by Jacob__mybb_import1.)
I got an error when I tried to use it, you're missing a "Parent" in both long lines.
Also, variables are case sensitive (so you need a lowercase or capital C everywhere, not both) and you have to put strings (letters, sentences, or words) in quotes or Lua will think you're trying to use a variable.
[lua]
Tool = script.Parent
function Change©
if c == "p" then
if Tool.Parent.Parent.Character.Body.Layer ~= 0 then
Tool.Parent.Parent.Character.Body.Layer = Tool.Parent.Parent.Character.Body.Layer-1
end
elseif c == "l" then
if Tool.Parent.Parent.Character.Body.Layer ~= 2 then
Tool.Parent.Parent.Character.Body.Layer = Tool.Parent.Parent.Character.Body.Layer+1
end
end
end
link(Tool.KeyDown, Change)
[/lua]
Also, variables are case sensitive (so you need a lowercase or capital C everywhere, not both) and you have to put strings (letters, sentences, or words) in quotes or Lua will think you're trying to use a variable.
[lua]
Tool = script.Parent
function Change©
if c == "p" then
if Tool.Parent.Parent.Character.Body.Layer ~= 0 then
Tool.Parent.Parent.Character.Body.Layer = Tool.Parent.Parent.Character.Body.Layer-1
end
elseif c == "l" then
if Tool.Parent.Parent.Character.Body.Layer ~= 2 then
Tool.Parent.Parent.Character.Body.Layer = Tool.Parent.Parent.Character.Body.Layer+1
end
end
end
link(Tool.KeyDown, Change)
[/lua]