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

How to change properties of multiple objects?

I am trying to make a script that looks for the buttons in a GuiFrame and then change properties

this doesn't work, there are no erorrs

for _, buttons in ipairs(game.StarterGui.MainGui.ShopFrame:GetDescendants()) do
			if buttons:IsA("TextButton") then
				buttons.BackgroundColor3 =  Color3.new(92, 195, 37)
				buttons.Text = "Purchase"
			end
		end

1 answer

✓ Accepted answer

You shouldn't use StarterGui, you should use PlayerGui instead.

local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui") -- get the LocalPlayers PlayerGui

for _, buttons in pairs(playerGui.MainGui.ShopFrame:GetDescendants()) do
	if buttons:IsA("TextButton") then
		buttons.BackgroundColor3 = Color3.fromRGB(92, 195, 37) -- you should use fromRGB()
		buttons.Text = "Purchase"
	end
end

Be sure to upvote and accept this answer if this helps you!

1 comment

0

sorry, cant upvote yet

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