when I started ROBLOX I tried to find out how to add creepers to my game . then I found out about scripting .I thought there might be a way to add creepers to my game using scripting.so I came here.
COMMUNITY QUESTION
how can i add creepers to my game?
2 answers
If you want to learn scripting I recommend Pighead10's Lua tutorial on YouTube or I could send you the Word docs of the old Lua learners basic course but I will be needing your Skype.
Creepers? No problem!
The simplest way is to just take a zombie script, (A script that detects the player)
Or import this script into your creeper model:
local larm = script.Parent:FindFirstChild("Torso")
local rarm = script.Parent:FindFirstChild("Right Leg")
local dmg = script.Parent:FindFirstChild("Head")
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 15
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Torso")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end
function Hit(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human ~= nil then
if script.Parent.Zombie.Health ~= 0 then
script.Parent.Zombie.WalkSpeed = 0
local Color = script.Parent["Body Colors"]
local FakeHead = script.Parent["FakeHead"]
Color.HeadColor = BrickColor.new("Bright red")
Color.LeftArmColor = BrickColor.new("Bright red")
Color.RightArmColor = BrickColor.new("Bright red")
Color.LeftLegColor = BrickColor.new("Bright red")
Color.RightLegColor = BrickColor.new("Bright red")
Color.TorsoColor = BrickColor.new("Bright red")
FakeHead.BrickColor = BrickColor.new("Bright red")
wait(0.75)
Color.HeadColor = BrickColor.new("Bright green")
Color.LeftArmColor = BrickColor.new("Bright green")
Color.RightArmColor = BrickColor.new("Bright green")
Color.LeftLegColor = BrickColor.new("Bright green")
Color.RightLegColor = BrickColor.new("Bright green")
Color.TorsoColor = BrickColor.new("Bright green")
FakeHead.BrickColor = BrickColor.new("Bright green")
wait(0.5)
Color.HeadColor = BrickColor.new("Bright red")
Color.LeftArmColor = BrickColor.new("Bright red")
Color.RightArmColor = BrickColor.new("Bright red")
Color.LeftLegColor = BrickColor.new("Bright red")
Color.RightLegColor = BrickColor.new("Bright red")
Color.TorsoColor = BrickColor.new("Bright red")
FakeHead.BrickColor = BrickColor.new("Bright red")
wait(0.25)
Color.HeadColor = BrickColor.new("Bright green")
Color.LeftArmColor = BrickColor.new("Bright green")
Color.RightArmColor = BrickColor.new("Bright green")
Color.LeftLegColor = BrickColor.new("Bright green")
Color.RightLegColor = BrickColor.new("Bright green")
Color.TorsoColor = BrickColor.new("Bright green")
FakeHead.BrickColor = BrickColor.new("Bright green")
local Ex = Instance.new("Explosion")
Ex.Parent = game.Workspace
Ex.Position = script.Parent.Torso.Position
script.Parent.Torso.Name = "Torsoz"
end
end
end
larm.Touched:connect(Hit)
rarm.Touched:connect(Hit)
dmg.Touched:connect(Hit)
This discussion is preserved as it was. New answers, comments, and votes are closed.
