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

How do I do this?

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!

1 comment

0

No script requests. This is considered a script request. Go to the wiki and search up for loops.

2 answers

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

1 comment

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"

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!

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