2DWorlds Forums
Need help - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Help (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=21)
+--- Thread: Need help (/showthread.php?tid=8505)



Need help - Dangerdan - 10-26-2011

Hello. I know LUA pretty well on roblox, and I'm used to the workspace on it, similar to this one. When I run 'game.World.Err:Remove()' on the command line, it says 'Err is not a child of world' Any clues on what I'm doing wrong? Im using this as a test to make a helicopter regen.


RE: Need help - Qwertygiy - 10-26-2011

Here's the code Paradox was attempting to fix for you:

[lua]
Heli = game.Environment.Helicopter
function OnCollide(collide)
h = Heli:clone()
h.Helip.Position = Vec2D(324.62,51.54)
if game.World:getChild("Helicopter") then
game.World.Helicopter:Remove()
end
end

link(script.Parent.Collide, OnCollide)
[/lua]
____________________________________________
[lua]
local enabled = true
link(script.Parent.Collided, function(hit)
if hit.Parent:isA("Character") and enabled then
local copter = game.Storage.Helicopter
local c = copter:clone()
local oldcop = game.World:getChild("Helicopter")
if oldcop then
oldcop:remove()
end
enabled = false
script.Parent.Color = Color(255, 0, 0)
sleep(3)
c.Parent = game.World
c:makeJoints()
script.Parent.Color = Color(0, 255, 0)
enabled = true
end end)
[/lua]

I think the makeJoints part needs work; I might be remembering it wrong.