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

How do I do this?

Asked by 9 years ago

Here's a screenshot to understand my problem: http://cobra-rblx.deviantart.com/art/Roblox-Scripting-Help-Lua-519721072

You will not understand what I'm trying to say without taking a look at the screenshot.

Well I'm not very experienced with Lua, but I want that script to refer all the "PACK" labeled item's properties. For example:

script.Parent.Parent

^^That is the type of code I want^^

I just need a simple 1 line of code that can help me refer to all those "PACK" items. It's really simple so please help!

0
No script requests. This is considered a script request. Go to the wiki and search up for loops. yumtaste 476 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

The answer to your question is quite complex and I doubt you'll be able to understand it. I suggest you just study a bit more about scripting, especially loops. Here's the script anyway:

local packs = script.Parent.Parent.Parent:GetChildren()
for a, pack in ipairs(packs) do
    if pack.Name == "PACK" then
        -- Do what you want to every PACK here
    end
end
0
But how do I make it visible = true on the click of a mouse? And do I put visible = true in "Do whatever you want to every PACK here" CobraCaptain 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago
local gui = game.StarterGui.Terms

script.Parent.MouseButton1Click:connect(function()
    for i, v in pairs (gui:GetChildren()) do
        if v.Name == "PACK" then
            v.Visible = true
    end
end

Try that. Read the output if there's any errors.

Hope this helped!

Answer this question