some scripting stuffs
#1
[lua]p = Instance.new("Part") -- Create a new brick
p.Parent = game.Workspace -- The part (a grey brick, by default) has a parent, the workspace
wait(1)
p.Parent = nil -- The part now has no parent (and so it disappears from view, but not from memory).
wait(1)
p.Parent = game.Workspace -- part still exists because it is referenced by the variable 'p'
wait(1)
p.Parent = nil -- part disappears again (it has no parent)
p = nil -- part is no longer referenced by anything, so it gets picked up by the garbagecollector
[/lua]
LEGIT BRO
(Oversized sig image removed)
Reply
#2
I moved this to the correct forum.
Reply
#3
Wrong game.

[lua]
p = create("Box") -- Create a new box
p.Parent = game.World -- The part (a grey box, by default) has a parent, the world
sleep(1)
p.Parent = nil -- The part now has no parent (and so it disappears from view, but not from memory).
sleep(1)
p.Parent = game.World -- part still exists because it is referenced by the variable 'p'
sleep(1)
p.Parent = nil -- part disappears again (it has no parent)
p = nil -- part is no longer referenced by anything, so it gets picked up by the garbagecollector
[/lua]
Reply
#4
So to execute a command you still go under the parent"Game"?

Liek game.World.Elite.Body:Remove()
Reply
#5
Yes, but all member functions (:Remove()) start with a lowercase letter.
Reply
#6
Like this.
[lua]
local players = game.Players:getChildren() --finds all players, which is kinda useless
--right now since there can only be one.
--BTW you need to make a Word Wrap for this, Jacob.
for q = 1, #players do --I could just say players[1], but I'll stick to multiplayer format
local e = create("Explosion")
local body = players[q]:getChild("Body") --in case it's been removed already somehow
e.Radius = 5
e.Parent = game.World
e.Position = body.Position
body.Velocity = Vec2D(0,100) --Fun to watch
sleep(1)
game:chat("You've been BEWMed", Color(0,0,0)) -- I might have that in wrong order
end
[/lua]
Big Grin
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)