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

for i,v parts?

Asked by
korj5 0
8 years ago

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

?

0
Static is not a member of every child of Rig User#6546 35 — 8y
0
It is. korj5 0 — 8y
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? User#11440 120 — 8y
0
But Static is in Rig; http://prntscr.com/bg0zoe korj5 0 — 8y
View all comments (4 more)
0
When you press the "activate alarm" and the emergency spinning light name(Static) and the error reports is appeared. korj5 0 — 8y
0
Try taking out the 'Static' in the script; make it v.Light.Toggle. Pyrondon 2089 — 8y
0
Every child of rig is called Static, but Static is not a member of every child of Rig. User#6546 35 — 8y
0
^^........ Wtf. koolkid8099 705 — 8y

1 answer

Log in to vote
0
Answered by
brianush1 235 Moderation Voter
8 years ago

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

Ad

Answer this question