You are on page 1of 3

--[[

Human die

94247848

Zombie die

94247848
93647326
89371632
72664863
--]]
local ZombieBlood = game.Lighting.ZombieBlood:Clone()
local RobloxBlood = game.Lighting.RobloxBlood:Clone()

local zdie = {94247848,93647326,89371632,72664863}

function createzombie(plr,pos)
local
zombie=game:GetService("InsertService"):LoadAsset(93601062):GetChildren()[1]
--local zombie=game.Lighting.Zombie:clone()

local creator=Instance.new("ObjectValue")
creator.Value=plr
creator.Name="creator"
creator.Parent=zombie

local p=Instance.new("Part")
p.Name="Effect"
p.Transparency=1
p.FormFactor="Custom"
p.Size=Vector3.new(.2,.2,.2)
p.Anchored=true
p.CFrame=CFrame.new(pos)+Vector3.new(0,-4,0)
--[[ local smoke=Instance.new("Smoke")
smoke.Color=Color3.new(0,.1,0)
smoke.RiseVelocity=10
smoke.Parent=p]]
local smoke=Instance.new("Fire")
smoke.Color=Color3.new(0,0,0)
smoke.SecondaryColor=Color3.new(0,1,0)
smoke.Size=10
smoke.Heat=100
smoke.Parent=p
game.Debris:AddItem(p,2)
p.Parent=game.Workspace
delay(1,function()
if smoke and smoke~=nil then
smoke.Enabled=false
end
end)

game.Debris:AddItem(zombie,60)
zombie.Parent=game.Workspace
zombie:MoveTo(pos)

zombie.Humanoid.Died:connect(function() zombiesplat(zombie.Humanoid) end)


end
function findClosestPlayerV(pos)

local p = game.Players:GetPlayers()
local maxd = 10000
local result = Vector3.new(0,0,0)
for i=1,#p do
if p[i].Character ~= nil then
local t = p[i].Character:FindFirstChild("Head")
if t ~= nil then
if (pos - t.Position).magnitude < maxd then
maxd = (pos - t.Position).magnitude
result = (pos - t.Position).unit
print(maxd)
end
end
end
end

return result

end

function zombiesplat(h)

local pos = h.Parent.Torso.Position

local s = Instance.new("Sound")
s.SoundId = "http://www.roblox.com/asset/?id=" .. zdie[math.random(4)]
s.Parent = h.Parent.Head
s:Play()

local v = findClosestPlayerV(h.Parent.Head.Position)

for i=1,10 do

local z = ZombieBlood:Clone()
z.CFrame = CFrame.new(pos + Vector3.new(0,i,0),
Vector3.new(math.random(), math.random(), math.random()))
z.Velocity = (v * 80) + (Vector3.new(math.random() - .5, math.random()
- .5, math.random() - .5) * 10) + Vector3.new(0,10,0)
z.RotVelocity = (Vector3.new(math.random() - .5, math.random() - .5,
math.random() - .5) * 10)
z.Parent = game.Workspace

game.Debris:AddItem(z, 30)
end

end

function HumanSplat(char)
print("human splat")
if char:FindFirstChild("Humanoid") == nil then return end
local h = char.Humanoid
local pos = h.Parent.Torso.Position

local s = Instance.new("Sound")
s.SoundId = "http://www.roblox.com/asset/?id=94247848"
s.Parent = h.Parent.Head
s:Play()

for i=1,10 do

local z = RobloxBlood:Clone()
z.CFrame = CFrame.new(pos + Vector3.new(0,i,0),
Vector3.new(math.random(), math.random(), math.random()))
z.Velocity = (Vector3.new(math.random() - .5, math.random() - .5,
math.random() - .5) * 10) + Vector3.new(0,10,0)
z.RotVelocity = (Vector3.new(math.random() - .5, math.random() - .5,
math.random() - .5) * 10)
z.Parent = game.Workspace

game.Debris:AddItem(z, 30)
end
end

function characterRespawned(char)
print("char respawned")
if char:FindFirstChild("Humanoid") ~= nil then
char.Humanoid.Died:connect(function() HumanSplat(char) end)
end
end

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(characterRespawned) end)
game.Players.PlayerAdded:connect(function(p) if p.userId == 261 then
game.Lighting.Railgun:Clone().Parent = p.StarterGear end end)

while true do

local r = 80
local a = math.random() * 3.1415 * 2
createzombie(nil, Vector3.new(math.cos(math.random() * a) * r, 10,
math.sin(math.random() * a) * r))

wait(.5)

end

You might also like