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

Inserting Player Name into Text?

This seems very basic, but I've been trying to learn lua better by doing this on my own.


function oc(pl, dc) 
	if (dc.Name == "Yes") then 
		print("You own this tycoon!") 
		workspace.Tycoon.DoorHeader.UnownedPharmacy.Name ="'s Tycoon" 
	end 
	if (dc.Name =="No") then 
		print("You do not own this tycoon!")
	end 
end 
script.Parent.DialogChoiceSelected:connect(oc)

more specifically, this line;


workspace.Tycoon.DoorHeader.UnownedPharmacy.Name ="'s Tycoon"

After Name= , I ideally want it to chance the name to Carcanken's Tycoon for example, if I executed the dialog.

Thanks!

1 answer

✓ Accepted answer

If you have the players name then it would be

workspace.Tycoon.DoorHeader.UnownedPharmacy.Name =player.Name.."'s Tycoon"

3 comments

0

How would I go about identifying the players name? I understand how to identify variables but not entirely for this situation.

0

Is the script local?

0

In this situation pl would be the player, thumbs this question up :)

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