Posts: 216
Threads: 18
Joined: Apr 2011
Reputation:
0
I edited the reset tool and made a "kill npc on click" tool
[lua]npc = game.World.NPC
link(script.Parent.MouseDown, function()
npc.Health = 0
end)[/lua]
I didn't want to put it on the wiki at first because it's a pretty useless too.
Posts: 964
Threads: 49
Joined: Apr 2011
Reputation:
0
Sweet. Here's the script I used for my tool at the end of my falling rocks game. Be sure to put the script in a tool, and also name the Tool "JetBoots".
[lua]
local mode = 1
names = {"JetBoots", "Exploder"}
function md(x,p)
if mode == 1 then
script.Parent.Parent.Parent.Character.Body.Controller.Velocity = Vec2D(0,5)
elseif mode == 2 then
y = create("Explosion")
y.Parent = game.World
y.Position = p
end
end
function mu()
if mode == 1 then
script.Parent.Parent.Parent.Character.Body.Controller.Velocity = Vec2D(0,0)
end
end
function kd(k)
if k == "e" then
if mode == #names then
mode = 1
else
mode = mode + 1
end
script.Parent.Name = names[mode]
elseif k == "q" then
if mode == 1 then
mode = #names
else
mode = mode - 1
end
script.Parent.Name = names[mode]
end
end
link(script.Parent.MouseDown, md)
link(script.Parent.MouseUp, mu)
link(script.Parent.KeyDown, kd)
[/lua]
Posts: 543
Threads: 102
Joined: Apr 2011
Reputation:
0
Magic carpet script (put in a tool)
[lua]local carpet=create("Box")
carpet.Name="carpet"
local player=script.Parent.Parent.Parent
carpet.Size=Vec2D(30,2)
carpet.Color=Color(128,0,128)
local fv=create("FixedVelocity")
create("FixedRotation").Parent=carpet
fv.Parent=carpet
local l=create("Label")
l.Parent=carpet
l.Text=player.Name.."'s Magic carpet"
function selected()
if carpet.Parent~=nil then return end
moveto()
carpet.Parent=player.Character
end
function moveto()
carpet.Position=player.Character.Body.Position:add(Vec2D(carpet.Size.x/2,0))
end
function keydown(k)
if k=="r" then
fv.Velocity=Vec2D(0,4-fv.Velocity.y):add(fv.Velocity)
elseif k=="h" then
fv.Velocity=Vec2D(0,0.47-fv.Velocity.y):add(fv.Velocity)
elseif k=="f" then
fv.Velocity=Vec2D(0,0-fv.Velocity.y):add(fv.Velocity)
end
if k=="n" then
moveto()
end
local speed=4
if k=="z" then
fv.Velocity=Vec2D(-speed-fv.Velocity.x,0):add(fv.Velocity)
elseif k=="x" then
fv.Velocity=Vec2D(speed-fv.Velocity.x,0):add(fv.Velocity)
elseif k=="c" then
fv.Velocity=Vec2D(-fv.Velocity.x,0):add(fv.Velocity)
carpet.Velocity=Vec2D(-carpet.Velocity.x,0):add(carpet.Velocity)
else
carpet.Velocity=Vec2D(-carpet.Velocity.x,0):add(carpet.Velocity)
end
end
function keyup(k)
end
link(script.Parent.Selected,selected)
link(script.Parent.KeyDown,keydown)
link(script.Parent.KeyUp,keyup)[/lua]
Siggy by McNoobster!