I am pretty proud of this non-working script... At 3:21 in the morning, even when rushed, I did good.
The script is suppose to:
[lua]t = create("TextValue")
n = create("NPC")
l = create("Label")
if msg == "clone;" then
n.Parent = game.Workspace
t.Parent = game.Storage
t.Name = speaker.Name
l.Parent = n
l.Text = speaker.Name .. "'s Clone"
n.Name = math.Random(1,10000) -- I don't know if this line is correct.
n.Body:remove()
speaker.Body:clone().Parent = n
n:clone().Parent = t
print("You have successfully cloned yourself.")
end[/lua]
Yes, I do know that this script could have been made easier, however, I chose not to show my newbie side in scripting.
EDIT: I retried the script; the TextValue ended up spawning, however, in the World. The script stopped after it was generated. It also ONLY generated the TextValue, even if the NPC was first.
The script is suppose to:
- make a TextValue in Storage
- make an NPC when someone says "clone;"
- changes the NPC's name to a random number up to 10,000 (and not have that same number chosen again by any person in the game, not implemented)
- change the NPC's regular body to the speaker's body
- create a label saying the speaker's name, then "'s Clone"
- copy the NPC into a TextValue in Storage
- print "You have successfully created a clone."
[lua]t = create("TextValue")
n = create("NPC")
l = create("Label")
if msg == "clone;" then
n.Parent = game.Workspace
t.Parent = game.Storage
t.Name = speaker.Name
l.Parent = n
l.Text = speaker.Name .. "'s Clone"
n.Name = math.Random(1,10000) -- I don't know if this line is correct.
n.Body:remove()
speaker.Body:clone().Parent = n
n:clone().Parent = t
print("You have successfully cloned yourself.")
end[/lua]
Yes, I do know that this script could have been made easier, however, I chose not to show my newbie side in scripting.
EDIT: I retried the script; the TextValue ended up spawning, however, in the World. The script stopped after it was generated. It also ONLY generated the TextValue, even if the NPC was first.
All my mods are available here.