Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Developer Console Error - Any solution?

Asked by 10 years ago

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

Log in to vote
0
Answered by
tambre2 25
10 years ago

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

0
I used local scripts to prevent a previous error "Equipped is not a valid member of HopperBin" which occurred when I used scripts. Steven1411 0 — 10y
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" tambre2 25 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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!

Answer this question