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

Not a Valid Member of model..?

Asked by 9 years ago

It says "Pan.Tilt.Mesh" is not a valid member of model?

local dir = "Pan.Tilt.Mesh";
local mac ={workspace.Mac1,workspace.Mac2,workspace.Mac3,workspace.Mac4,workspace.Mac5,workspace.Mac6,workspace.Mac7,workspace.Mac8}

function Clicked()
    if script.Parent.Bool.Value == false then
        for i,v in pairs(mac) do
        v[dir].Transparency = v[dir].Transparency + 0.5
        script.Parent.Bool.Value = true
    end
    end
    end
script.Parent.MouseButton1Down:connect(Clicked)
0
Is the name of the instances "Pan.Tilt.Mesh" or is that the location of it inside one of the Mac's? Epidemiology 116 — 9y
0
It goes "game.Workspace.Mac1.Pan.Tilt.Mesh" same for all the other macs. UnleashedGamers 257 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

With string.gmatch you can get the location with the string as shown below.

local dir = "Pan.Tilt.Mesh";
local mac ={workspace.Mac1,workspace.Mac2,workspace.Mac3,workspace.Mac4,workspace.Mac5,workspace.Mac6,workspace.Mac7,workspace.Mac8}

function Clicked()
    if script.Parent.Bool.Value == false then
        for i,v in pairs(mac) do
        local d = v
        for k in dir:gmatch('[^.]+') do
            d = d[k]
        end
        d.Transparency = d.Transparency + 0.5
        script.Parent.Bool.Value = true
    end
    end
    end
script.Parent.MouseButton1Down:connect(Clicked)

0
Error : Workspace.Screen2.Screen.SurfaceGui.Frame.MacBeams.AllOn.Script:9: 'do' expected near 'd' UnleashedGamers 257 — 9y
0
Oops, forgot the do after gmatch(), fixed. Epidemiology 116 — 9y
0
Error : P is not a valid member of Model UnleashedGamers 257 — 9y
0
Sorry, the + goes outside of the []'s, I should really start verifying that I have not made a typo... (fixing) Epidemiology 116 — 9y
View all comments (6 more)
0
Okay, just let me know when you check everything. UnleashedGamers 257 — 9y
0
I did do it that time, as long as the dir value is correct, it should work, otherwise it will just throw the "Not a Valid Member" error Epidemiology 116 — 9y
0
Well, same thing happened again... Error : Pan.Tilt.Mesh is not a valid member of Part UnleashedGamers 257 — 9y
0
This is what it looks like in workspace.. http://prntscr.com/7zbkr6 UnleashedGamers 257 — 9y
0
Sorry for not testing properly, I do not commonly post on here and forget to test, I tested the pattern not the entire thing, I did not remove the [dir]. Epidemiology 116 — 9y
0
Transparency is not a valid member of model... UnleashedGamers 257 — 9y
Ad

Answer this question