Help with rich text on script

I always get this problem when I try to put rich text stuff in a localscript.
how do I fix this?

it’s because you are using speechmarks inside the speechmarks and the script is reading it like this ( i replaced the speechmarks with parenthesis so you can see it better )

local textxd = (Received Item <font color =) #FFA500 (>) .. child.Name.. (</font>)

try replacing the open and close speechmarks with punctuation marks so you can use the speechmarks inside, like this for example

local textxd = 'Received Item <font color="#FFA500">' .. child.Name .. '</font>' 

Escape the " and ’ characters. So you don’t cut off the string values earlier than intended.

You can escape a character by putting a \ before it.

local textxd = "Received Item <font color=\"#FFA500\">"..child.Name.."</font>"

1 Like

I solved a similar case to your question right here

so i’ll just copy the answer over

Instead of defining the string using quotes use [[ and ]] !

local textxd=[[Received Item <font color="rgb(255, 255, 255)">]]..child.Name..[[</font> and that's it's name.]]

No, your answer worked but I want it so the name will be between a <>

It won’t work sadly, there’s no errors too.
I want it to look like this from GPO:

oh, okay. i’ll try to rewrite the reply so if others need it

maybe try this?

local textxd = 'Received <font color ="#6AD76A">' .. '<' .. child.Name.. '>' .. '</font>

didn’t work sadly. eeeee 20chr

what do you mean by not working, is < not showing?

it is showing but the rich text wont work, like it just displays as this.image

oh okay, wait how about you turn it into a string first and then add it into the variable, like this.

local childname = "<"..child.Name..">"
local textxd = 'Received <font color ="#6AD76A">' .. childname .. '</font>'

nope, still doesn’t fix it sadly.

how about this?

local childname = "<"..child.Name..">"
local textxd = 'Received <font color ="#6AD76A">' .. tostring(childname) .. '</font>'
local textxd = 'Received Item <font color="#FFA500">' .. child.Name .. '</font>' 

Should work like on the Marked Solution.

The problem here was you included: (The one with the ‘**’)

<font color="#FFA500"> **<**' .. child.Name .. '**>** </font>'

Try removing that and see if it works.

that’s the point, I’m trying to make it so it’s gonna pop up as

like this, that’s what I said on posts above

doesn’t work still, this is so frustrating when you’re just an average scripter.

Let me test it.


200000000000 chars

or maybe you can do it by changing ‘<’ this and child.Name and ‘>’ this separately, like this.

local textxd = 'Received <font color="#6AD76A">' ..'<'.. '</font>' .. '<font color="#6AD76A">' ..child.Name.. '</font>' ..  '<font color="#6AD76A">' ..'>'.. '</font>'

i have not tested it so i’m not sure if it would work.

It works for me tho

they want this < > with Magu inside and not just Magu.