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

How to i use a StringValue's value in a directory?

local taskbar = script.Parent
local main = script.Parent.Parent.Applications.Main

for i,v in pairs(taskbar:GetChildren()) do
local Value = v.AppName.Value

v.MouseButton1Click:Connect(function()
main.["Value"].Visible = true
end)
end

So that is what i have right now. i am doing this to save my time so if i ever need to change the name of the frame i dont need to change a script.

2 comments

0

and what i am wanting to happen is when the button gets clicked the frame aka app with that value as its name will be visible

0

Replace line 8 with "main[Value].Visible = true"

2 answers

✓ Accepted answer

Do

local taskbar = script.Parent
local main = script.Parent.Parent.Applications.Main

for i,v in pairs(taskbar:GetChildren()) do
	local Value = v.AppName.Value
	v.MouseButton1Click:Connect(function()
		main.[Value].Visible = true
	end)
end

Just delete the quotes

Ok if you came here to find out how to do it so you want to get the value of the string value.

so to get the value you need to do .Value

local Value = script.Parent.Parent.StringValue.Value
--then to get the value into directory do

script.Parent[Value].Whatever
--so there in place of Whatever you could change a property or Anything really.

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