How to connect values with text

I don’t really know how to explain this so sorry but I have this code. I have seen it done before but I forgot how to do it.
image

It doesn’t seem to work can you help?

2 Likes

What does exactly not work? Try to be more specific, the concating seems right, but it doesn’t make too much sense what you’re connecting.

1 Like

Please explain what you want, I’m confused.

1 Like

I have a npc and when you click on them it says “What do you want?” But whenever I added the new part …Player.Candyvalue etc nothing happens when i click them.

2 Likes

Make sure you’ve defined player, and make sure CandyCounter is an actual value

1 Like

Yeah everything is defined and its a actual value but nothing pops up.

You mind sharing us your output?

Nothing comes out in the output.actually, this comes in the output
image

But everything is how it is.

image

1 Like

Also, could you try to share us the entire script? It’s a bit hard to recognize the problem, as that seems like it would work just fine.

If it’s a leaderstate then add Player.leaderstats.CandyCounter.Value…“Candies”

image
Is the top part of the script, But player.Data.Candycounter is a actual thing and its in that error. It only doesn’t work when I add it to dialogue.

Did you define a player variable?

EDIT: That is the problem. It’s why the output said you were indexing nil with ‘Data’

I see the player variable is wrong it has to be capitalized.

it wouldn’t work either if its capitalized

the script doesn’t know what player is as its not defined, although Players is

Well its the only thing that the output can’t define did you try it?

It’s why there was the problem with indexing nil on the output, no “player” variable defined.

So I defined Player as local Player = game.Players.LocalPlayer and it didnt work did I define it wrong?

Also you have to do Player.LocalPlayer.Data

There where the player has a orange line

Change it to “Player” instead of “player”.