![]() |
What do? - 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: What do? (/showthread.php?tid=8744) |
What do? - Mustachio - 01-03-2012 function changeWorld(p) game.World = game:getWorld("Level0").World script.Parent.Parent = p end link(script.Parent.MouseDown, changeWorld) It keeps saying Script:2: World is not a property of Root RE: What do? - Qwertygiy - 01-03-2012 You don't try to set game.World, at least I don't think so. You need to switch the objects' parents to the other world. For example, [lua] function changeWorld(p, w) p.Parent = game:getWorld(w).Players p.Character.Parent = game:getWorld(w).World script.Parent.Parent = p end link(script.Parent.MouseDown, changeWorld) [/lua] RE: What do? - Qwertygiy - 01-03-2012 Fixed code: [lua] function changeWorld(p, w) p.Parent = game:getWorld(w).Players p.Character.Parent = game:getWorld(w).World end link(script.Parent.MouseDown, function() changeWorld(script.Parent.Parent.Parent.Parent, "level0") end) [/lua] This is for a script inside a text button inside a frame inside the main player UI. To get rid of the button and whatnot, I'll let you code that out how you want. |