Script parents aren't being located. Can someone help?
Hello I've got a problem with locating a certain model
I've got a button which toggles off/on strobe lights for a plane. I've got a GUI in a first officers seat, when you sit in the seat you get the gui, the button is in the GUI.
The button contains this code:
01 | kit = script.Parent.Parent.Parent.Parent.Parent.Parent.StrobeLights |
07 | button.MouseButton 1 Down:connect( function () |
11 | if toggle = = false then |
15 | while toggle = = true do |
18 | kit.LightA.PointLight.Enabled = true |
19 | kit.LightA.BillboardGui.Enabled = true |
21 | kit.LightA.PointLight.Enabled = false |
22 | kit.LightA.BillboardGui.Enabled = false |
25 | kit.LightA.PointLight.Enabled = true |
26 | kit.LightA.BillboardGui.Enabled = true |
28 | kit.LightA.PointLight.Enabled = false |
29 | kit.LightA.BillboardGui.Enabled = false |
36 | button.MouseButton 2 Down:connect( function () |
The problem is, the script locates it's Parents before it's equipped and it locatesthem after.
Even though other codes uses the exact same line:
1 | kit = script.Parent.Parent.Parent.Parent.Parent.Parent.StrobeLights |
Is there a way to make it locate only before it's equipped?