i wanna find a way to mention the user in a dialog. Its 1 player servers, so it doesnt have to change every single time : ). I dont know if this is possible, but I really want to try. Don’t think this has been discussed anywhere, so I decided to ask here.
I’m kind of confused with what you are saying.
Do you mean having a text label display dialogue with the players name in it?
This is pretty simple to do. You can use string formatting:
local Player = game:GetService("Players").LocalPlayer
local yourText = "Hello, %s" --> %s tells the formatted to replace this with something else
local textWithPlayerName = string.format(
yourText,
Player.Name
) --> replaces "%s" with the players name
Alternatively, you can use gsub
to replace all occurrences with the player name:
local Player = game:GetService("Players").LocalPlayer
local yourText = "Hello, [Player]. Nice to meet you, [Player]"
local textWithPlayerName = string.gsub(
yourText,
"[Player]", --> finds all occurrences of "[Player]" in "yourText"
Player.Name --> replaces occurrences of "[Player]" in "yourText" to the player's name
)
1 Like
i mean with the dialog feature, but I can work with this : )
fyi, you probably shouldn’t be using the dialog feature anymore
it’s mostly clientsided, old, and doesn’t look nice compared to roblox’s modern UI
i’d suggest just making your own dialog system or using one off of the toolbox
1 Like
oh okay, thanks :DDD
also nice cone hat :DDD
1 Like