What do?
#1
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
Reply
#2
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]
Reply
#3
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)