function onKeyPress(inputObject, gameProcessedEvent) if gameProcessedEvent then return end if inputObject.KeyCode == Enum.KeyCode.Z then if script.Parent == true then script.Parent = false else script.Parent = true end end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
the script above is supposed to turn the scripts parent(a frame), invisible. when i press z, i get this error:
Players.Player1.PlayerGui.create.inventory.fds:7: bad argument #3 to 'Parent' (Object expected, got boolean)
You have to access the Visible property!
function onKeyPress(inputObject, gameProcessedEvent) if gameProcessedEvent then return end if inputObject.KeyCode == Enum.KeyCode.Z then script.Parent.Visible = not script.Parent.Visible -- shorten it up for ya end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Line 06/07: You try to set your script's parent to "false." You can only set other objects in the "Parent" property.
EDIT: I hit answer before answering how to fix your script, instead of changing the script's "Parent" to false (which will never work,) change it's "Visible" property.