How to change get a textlabel in a descendants loop based on its text

local TextChatService = game:GetService("TextChatService")

local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")

local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

ChatService.SpeakerAdded:Connect(function(PlrName)
	print("SpeakerAdded")
	local Speaker = ChatService:GetSpeaker(PlrName)
	local player = game.Players[PlrName]
	local EquippedTag = player.SavedValues.EquippedTag
	EquippedTag.Changed:Connect(function()
		local tag = game.ReplicatedStorage.Tags:FindFirstChild(EquippedTag.Value).Frame:FindFirstChild(EquippedTag.Value.."Preview")		
		Speaker:SetExtraData("Tags", {{TagText = tag.Text, TagColor = tag.TextColor3}})
	end)
end)

for _, textLabel in pairs(scroller:GetDescendants()) do
	print(textLabel)
	if textLabel:IsA("TextLabel") and textLabel.Text == "[LEGENDARY]" then
		rainbowText(textLabel)
	end
end

scroller.DescendantAdded:Connect(function(textLabel)
	if textLabel:IsA("TextLabel")  and textLabel.Text == "[LEGENDARY]" then
		rainbowText(textLabel)
	end
end)

I have been having trouble getting the textLabel with the text [LEGENDARY] and wont go through even though the textLabel text is “[LEGENDARY]”

Any help is appreciated.

Have you tried changing that to just "LEGENDARY"

If that doesn’t work then try these 2 things:
print(textLabel.Text)
and
Replace

To string.find(textLabel.Text, "LEGENDARY")

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.