Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how can i add creepers to my game?

Asked by 10 years ago

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.

2 answers

Log in to vote
0
Answered by
Kozero 120
10 years ago

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.

Ad
Log in to vote
0
Answered by 10 years ago

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)

Answer this question