msg - Printable Version +- 2DWorlds Forums (http://2dworlds.buildism.net/forum) +-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4) +--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13) +--- Thread: msg (/showthread.php?tid=6271) |
msg - Nyht - 06-28-2011 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. RE: msg - Qwertygiy - 06-28-2011 Instead of [lua] n.Name = math.Random(1,10000) n.Body:remove() speaker.Body:clone().Parent = n [/lua] Try [lua] n.Name = tostring(math.random(1,10000)) n.Skin = speaker.Character.Skin [/lua] if speaker is a Player. RE: msg - Nyht - 06-28-2011 (06-28-2011, 01:01 PM)Qwertygiy Wrote: Instead of Thanks, but the sixth line in was incorrect. I put .Workspace, not .World. Still fails to work, and I have done tweaks here and there: [lua]t = create("TextValue") n = create("NPC") l = create("Label") if msg == "clone;" then n.Parent = game.World t.Parent = game.Storage t.Name = speaker.Name l.Parent = n l.Text = speaker.Name .. "'s Clone" n.Name = tostring(math.random(1,10000)) n.Skin = speaker.Character.Skin n:clone().Parent = t print("You have successfully cloned yourself.") end [/lua] RE: msg - Blandflakes - 06-28-2011 lol I do that a lot also. I'll use wait() instead of sleep() RE: msg - Nyht - 06-28-2011 I rewrote the script. [lua]--[[ I have no idea this one script is causing me so much grief... ]] if msg == "/clone" then clone = create("NPC") clone.Parent = game.World clone.Skin = speaker.Character.Skin clone.Name = tostring(math.random(1,10000)) label = create("Label") label.Parent = clone label.Text = speaker.Name model = create("Model") model2 = create("Model") model.Parent = game.World model2.Parent = game.Storage model.Name = speaker.Name model2.Name = speaker.Name clone:clone().Parent = model2 print("You have created " .. clone.Name .. ", remember this name to restore and delete.") end[/lua] I am going to re-write it a third time to be even more advanced then this; e.g. someone can actually make their label name for the NPC, ect I'll also add a "/follow" and "/stop" command after I implement the "/remove" commands. |