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

This chat message involving random generated text isn't working. What do I do?

local Letters =
 {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}
bc = BrickColor.new("Really blue")

math.randomseed(tick())
game.Players.PlayerAdded:connect(function(Player)
    wait(1)
    local text = ""
	wait(1) 
    for i = 1,5 do
	wait(1)
        text = text..((((i/2 == math.floor(i/2)) and math.random(0,9)) or Letters[math.random(1,#Letters)]))..((i == 2 and "-") or "")
    end
    print("Working")
    a = text
end)

game.StarterGui:SetCore("ChatMakeSystemMessage", {
	Text = "[Arona] Hello Test Subject. Please go ahead and push the box in the hole to verify your humanity." + " Your Test Subject Recollection Name is : " + a;
	Font = Enum.Font.Arial;
	Color = bc.Color;
	FontSize = Enum.FontSize.Size96;	
})

Expectation : [Arona] Hello Test Subject. Please go ahead and push the box in the hole to verify your humanity. Your Test Subject Recollection Name is : (2 figures - 3 figures)

Tree: StarterPlayer StarterPlayerScripts LocalScript(Where this is ^^^)

1 answer

You can't use + operator to concatenate strings. Instead, use ... Also, since it's a LocalScript, you don't need to use PlayerAdded

local Letters =
 {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}
bc = BrickColor.new("Really blue")

math.randomseed(tick())
wait(1)
local text = ""
wait(1) 
for i = 1,5 do
	wait(1)
	text = text..((((i/2 == math.floor(i/2)) and math.random(0,9)) or Letters[math.random(1,#Letters)]))..((i == 2 and "-") or "")
end
print("Working")
local a = text

game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "[Arona] Hello Test Subject. Please go ahead and push the box in the hole to verify your humanity. Your Test Subject Recollection Name is : " .. a;
    Font = Enum.Font.Arial;
    Color = bc.Color;
    FontSize = Enum.FontSize.Size96;    
})

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