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

for i,v parts?

Hello there, I'm new scripter, of course still learning. I am having trouble with this lines, it's really bother, giving me headache.

Locals scripts that will might help you to understand

local lights = {}
local static = true
local dis = false
local area = Workspace.Rig:GetChildren()
for i=1,#area do
	table.insert(lights,area[i])
end

V That script I'm having trouble V

function Alarm()
	if script.Parent.alarm.Text == "Activate Alarm" then
		script.Parent.alarm.Text = "Deactivate Alarm"
		for i,v in next, workspace.Rig:GetChildren() do
			v.Static.Light.Toggle = true
		end
else
	script.Parent.alarm.Text = "Activate Alarm"
	for i,v in next, workspace.Rig:GetChildren() do
			v.Static.Light.Toggle = true
	end
	end
	end

The error was

14:57:57.436 - Static is not a valid member of Model 14:57:57.438 - Script 'Workspace.Model.Screen.SurfaceGui.ImageLabel.Script', Line 266 14:57:57.440 - Stack End

?

8 comments

0

Static is not a member of every child of Rig

0

It is.

0

Yes, as eLuante said, on line 17 and 22, "Static is not a child of Rig". Just what exactly are you trying to do on line 17 and 22 of the above script?

0

But Static is in Rig; http://prntscr.com/bg0zoe

0

When you press the "activate alarm" and the emergency spinning light name(Static) and the error reports is appeared.

0

Try taking out the 'Static' in the script; make it v.Light.Toggle.

0

Every child of rig is called Static, but Static is not a member of every child of Rig.

0

^^........ Wtf.

1 answer

✓ Accepted answer

According to your comment, (http://prntscr.com/bg0zoe) each member of "Rig" is named "Static," but you are trying to access Rig.Static.Static, rather than simply Rig.Static. Here's the fixed code:

Locals scripts that will might help you to understand

local lights = {}
local static = true
local dis = false
local area = Workspace.Rig:GetChildren()
for i=1,#area do
    table.insert(lights,area[i])
end

V That script I'm having trouble V

function Alarm()
    if script.Parent.alarm.Text == "Activate Alarm" then
        script.Parent.alarm.Text = "Deactivate Alarm"
        for i,v in next, workspace.Rig:GetChildren() do
            v.Light.Toggle = true
        end
else
    script.Parent.alarm.Text = "Activate Alarm"
    for i,v in next, workspace.Rig:GetChildren() do
            v.Light.Toggle = true
    end
    end
    end

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