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

How would I make a name add up over and over?

Asked by 8 years ago

I am trying to make a script for my admin commands so when I continue spawning something, it adds +1 to the end of the name so the look doesn't everlay the same part..

I tried


p.Name = p.Name + p.Name .. "1"--and that did not work

I know this is simple, I just don't remember how to do it xD

2 answers

Log in to vote
0
Answered by 8 years ago

Count them

If you have a count of how many you've spawned, it's really simple. Take this nearly-code stub:

function spawn(object)
  newObject = object:Clone()
  newObject.Name = newObject.Name .. tostring(count)
  newObject.Parent = workspace
  count = count+1
end
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago
p.Name = p.Name .. p.Name .. "1"

Answer this question