User:Zitbam/Hat swarms

From Legacy Roblox Wiki
Revision as of 23:00, 28 July 2008 by >Zitbam
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
me = game.Players.zitbam 
function onChatted(msg) 
msg = msg 
if string.match(msg, "hat/") then 
p = game.Workspace.zitbam:GetChildren() 
for n = 1,#p do 
for w in string.gmatch(msg, "%d+") do 
if (p[n].className == "Hat") then 
for i = 1,w do 
wait(0.00001) 
t = Clone(p[n].Handle) 
t.Parent = game.Workspace 
t.CanCollide = true 
t.Anchored = false 
t.Position = me.Character.Torso.Position 
t.Name = "HatRocket" 
local rp = Instance.new("RocketPropulsion") 
rp.Parent = t 
rp.Target = me.Character.Head 
rp.MaxSpeed = 999999999 
rp:Fire() 
end 
end 
end 
end 
end 
if string.match(msg, "attack/") then 
players = game.Players:GetChildren() 
for i = 1,#players do 
if string.match(msg, string.lower(players[i].Name)) then 
p = game.Workspace:GetChildren() 
for n = 1,#p do 
if (p[n].Name == "HatRocket") then 
p[n].RocketPropulsion.Target = players[i].Character.Head 
end 
end 
end 
end 
end 
if string.match(msg, "rocket/") then 
players = game.Players:GetChildren() 
for i = 1,#players do 
if string.match(msg, string.lower(players[i].Name)) then 
p = game.Workspace:GetChildren() 
for n = 1,#p do 
if (p[n].Name == "HatRocket") then 
p[n].RocketPropulsion.Target = players[i].Character.Head 
p[n].RocketPropulsion.CartoonFactor = 1 
p[n].RocketPropulsion.TargetRadius = 3 
function onBlown(hit) 
hit = p[n].RocketPropulsion.Target 
if (hit ~= nil) then 
local e = Instance.new("Explosion") 
e.Parent = hit.Parent 
e.BlastPressure = 9999 
e.Position = p[n].Position 
e.BlastRadius = 5 
wait(3) 
Remove(p[n])
end 
end 
boom = p[n].RocketPropulsion.ReachedTarget:connect(onBlown) 
wait(5) 
boom:disconnect() 
end 
end 
end 
end 
end 
if (msg == "disperse") then 
local p = game.Workspace:GetChildren() 
for i = 1,#p do 
if (p[i].Name == "HatRocket") then 
p[i].RocketPropulsion.MaxSpeed = 0 
local e = Instance.new("Explosion") 
e.Parent = game.Workspace 
e.Position = p[i].Position 
e.BlastPressure = 99 
Remove(p[i]) 
end 
end 
end 
end 
me.Chatted:connect(onChatted)