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

How to make my array table script work properly with my screenGUI ?

Asked by 3 years ago

I've got a full-screen GUI and a GUI where you can choose colours to change the background to. I want to make the texts on screen change as well, but theres a long list of them so I tried to make an array. I'm new to scripting and especially tables, so I don't know what I'm doing wrong or how to make this script work. Can someone please help and take a look?

local background = script.Parent.Parent.Parent.Parent.ScreenGui.Frame
local text = {script.Parent.Parent.Parent.Parent.ScreenGui.Frame.Generate,script.Parent.Parent.Parent.Parent.ScreenGui.Frame.Sentence,script.Parent.Parent.Parent.Parent.Shop.Shop,script.Parent.Parent.Parent.Parent.CustomPhrases.Phrases,script.Parent.Parent.Parent.Parent.Colours.Menu}


script.Parent.MouseButton1Click:connect(function()
    background.BackgroundColor3 = Color3.fromRGB(177, 0, 0) 
    text.TextColor3 = Color3.fromRGB(0, 0, 0)
end)

Basically, the script only changes the background colour and not the text

And yes I know it probably isn't the most efficient way by listing script.Parent a bunch, but I'm learning and starting with screen GUIs so please be understanding!

0
Your Parent climb is atrocious, you should be placing your program near the assets you're hoping to work with. If you're going to refer to the same asset as you do on line 02 to reference other objects, allocate it as a variable. Ziffixture 6913 — 3y
0
You need to iterate over your array to properly perform the 'TextColor3' assignment instruction on each Instance within the Table. By the code context, you're attempting to refer to a key titled 'TextColor3'. Ziffixture 6913 — 3y
0
Methods are TitleCase, lowercase 'connect' of RBXScriptSignal was deprecated ages ago. Ziffixture 6913 — 3y

Answer this question