Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Developer Console Error - Any solution?

I made two scripts each for two lights on my aircraft to turn on and off using the keys "G" and "H" for Crazyman32's planekit. I'll provide the scripts below.

local tool = script.Parent
tool = PlaneKit.Plane.MainParts.MainSeat.Plane
tool.Equipped:connect(function(mouse)
	mouse.KeyDown:connect(function(key)
	if key == "H" then
			game.Workspace.PlaneKit.Plane.LandingGear.LandingLight1.PointLight.Enabled = true
			game.Workspace.PlaneKit.Plane.LandingGear.LandingLight1.Light.Enabled = true
			if key == "H" then 
				game.Workspace.PlaneKit.Plane.LandingGear.LandingLight1.PointLight.Enabled = false
				game.Workspace.PlaneKit.Plane.LandingGear.LandingLight1.Light.Enabled = false
			end
		end
	end)
end)
local tool = script.Parent
tool = PlaneKit.Plane.MainParts.MainSeat.Plane
tool.Equipped:connect(function(mouse)
	mouse.KeyDown:connect(function(key)
		if key == "G" then
			game.Workspace.PlaneKit.Plane.LandingGear.LandingLight2.PointLight.Enabled = false
			game.Workspace.PlaneKit.Plane.LandingGear.LandingLight2.Light.Enabled = false
			if key == "G" then
				game.Workspace.PlaneKit.Plane.LandingGear.LandingLight2.PointLight.Enabled = true
				game.Workspace.PlaneKit.Plane.LandingGear.LandingLight2.Light.Enabled = true 
			end
		end
	end)
end)

These scripts have no errors inside them and I've made sure that they are correct. I go into the game to test my aircraft out and play around with the scripts. Now that's the problem. They don't work, I opened the developer console as an action of this and I received this but have no idea how to resolve this problem. "attempt to index global 'PlaneKit' (a nil value)" - Any ideas on how I can fix this?

2 answers

You don't have anything in workspace called PlaneKit. Are you using a local script? If yes, try using a script.

2 comments

0

I used local scripts to prevent a previous error "Equipped is not a valid member of HopperBin" which occurred when I used scripts.

0

The PlaneKit doensn't simply exsist in Workspace. You should change "PlaneKit.Plane.MainParts.MainSeat.Plane" to "game.Workspace.PlaneKit.Plane.MainParts.MainSeat.Plane"

In line 2 in both scripts, you attempt to index Planekit, but Planekit was never defined anywhere in the script. That's the problem; either you remove that line, or you change Planekit to game.Workspace.Planekit or something like that. Hope this helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.