How to use emojis in identifiers

I have been coding a leaderstats system for the past hour or so and have encountered a problem. I chose to use emojis in the leaderboard as shown below:

Imgur

The only problem is, when I want to interact and change the values of the intvalues, I can’t do it because of the emoji.

Imgur

Does anyone know any fix to this like another way to declare my local variable while avoiding the emoji?

1 Like

Name them “Fossils” and “Coins”, and index them like that in the script, then rename them in the script to include the emoji.

Edit: Nevermind, just use @acreol solution below (not sure why I felt the need to come up with an overcomplicated solution)

2 Likes

instead of using . to index you can use brackets [] to index with expressions instead of with just identifiers
since strings are expressions you can have the following:

local fossils=game.player.leaderstats['💀Fossils'].value
5 Likes

Yeah, just like this.

Since you’re probably going to be changing these every now and then i’d store each one in a variable.


FossilString = '💀Fossils'

local Fossils = game.Player.leaderstats[FossilString].value

I’d also wait for it instead of assuming it’s there, but that’s just me.

2 Likes

I’d rather you give the solution to @acreol, as he was the first response with a solution.

1 Like