Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you change names of objects while keeping the old name?

Asked by
DemGame 271 Moderation Voter
4 years ago

I would like to change a name of an object in a way that includes the old object's name. For example, if the object is named "lol", I would like to change the name to "lol's shield" and if it was named "yes" i would like to change the name to "yes's shield". Any suggestions?

1 answer

Log in to vote
1
Answered by 4 years ago

I believe this script should work. I might not be very good at explaining.

local oldobject = workspace.yes -- Your object

oldobject.Name = oldobject.Name .. "'s shield" -- "yes" --> "yes's shield"

In Lua, I believe string concatenation essentially adds multiple strings together, seperated by ".."

0
Thanks. DemGame 271 — 4y
Ad

Answer this question