Gravity Tool
#1
Put this script in a tool:

[lua]
force = 0
target = nil
strength = 5
run = false

function mouseDown(b, pos)
if b == 3 then
force = strength
elseif b == 1 then
force = -strength
end
target = pos
run = true
end

link(script.Parent.MouseDragged, function(b, pos)
mouseDown(b, pos)
end)

link(script.Parent.MouseDown, function(b, pos)
mouseDown(b, pos)
end)

link(script.Parent.MouseUp, function(pos)
force = 0
run = false
end)


while true do
if run and force ~= 0 then
local c = game.World:getChildren()
for i=1, #c do
if (c[i]:isA("Box") or c[i]:isA("Circle")) and c[i].Fixed == false then
d = c[i].PositionConfusedub(target).normalized
c[i].Velocity = d:mul(force)
end
end
end
sleep(0.1)
end
[/lua]

Left click to make black holes, right click to make white holes.

Feel free to make a game with this!
Reply


Messages In This Thread
Gravity Tool - by Jacob__mybb_import1 - 04-04-2011, 01:29 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)