How do i make a zombie?

How can I make a well-scripted zombie in Roblox studio?

2 Likes

It depends what you want, if its pathfinding, it to attack a player, or both.

Here have a bunch of references:

https://developer.roblox.com/en-us/api-reference/class/PathfindingService
https://developer.roblox.com/en-us/api-reference/function/Humanoid/takeDamage
https://www.roblox.com/library/187789986/Drooling-Zombie
https://www.roblox.com/library/3924238625/Drooling-Zombie-Rthro

We can’t give you a script, but we can give you some ideas on how to do it

3 Likes

another good reference is the roblox studio zombie free model!

Ah yes, the 250k installed Zombies

1 Like

I can’t stand to look at the Rthro one. :face_vomiting:

I recommend using the the first one for beginning, but then make your own model as soon as possible, since as @Jackscarlett said, it’s been installed a lot of times, meaning a lot of games have them.

2 Likes

This isnt going to be easy, however, this is a good learning experience if you are just starting off.

Here might be a basic idea of the scripts:

  • A script for each zombie humanoid that loops through players, finds the closest player, and then move towards the closest player

  • A script for each zombie that checks if a player is touching the zombie, when did the player last get hurt, and if the player was hurt more than a second ago, hurt the player

  • A modulescript that interacts with the hurt script and keeps track of how long since a player has been hurt

These are the basic principles of my zombie code system

If you have just finished learning Roblox Lua, understand Lua and thr logic of coding, and understand what OOP is, then I highly recommend you to try creating a zombie system, as it will be great practice for your skills.

what is an OOP? can you please explain it to me

1 Like

I believe OOP is Object Orientated Programming

Idk much about it, but there has been a couple of posts relevant to that certain subject; you can look at these:

2 Likes

OOP stands for Object Oriented Programming.

OOP has two main parts, Classes and Objects.

You can think of it like this:

  • OOP is like the design of a bunch of houses
  • Classes in OOP are like blueprints for houses. Classes define the properties and methods of an object
  • An object is like a house, which implements the blueprint or class

Each class also has properties, methods, and in Roblox Lua, events

  • Properties are variables assigned to a object. This could be like for example, if we are using OOP for houses, the house color. House.HouseColor -- The HouseColor property of an object
  • Methods are functions assigned to an object
    House:CloseDoor () --CloseDoor method of an object
  • Events are things that run when something happens
    House.DoorOpened:Connect(function () ) --Code runs when the DoorOpened event is fired, or triggered

In Roblox, you create an object when you do Instance.new ("Object Name here") (Creating classes is not implemented in roblox Lua, so you have to get hacky and use metatables and stuff)

Remeber that like all things in programming it doesnt have to be these methods, properties, or events and it doesn’t have to be about houses

1 Like

If you want a well scripted NPC be prepared to put in a good amount of time lol here’s where I learned my first decent npc from: Roblox - Zombie Advanced AI Tutorial (Pathfinding, Custom Animations, Raycasting) - YouTube

1 Like

This might be a late response, but you can make a zombie using pathfinding or move to using magnitude and attack a player when the zombie is close enough. I don’t take the pathfinding route because it is very slow and the zombie takes time to compute the path to get to the player that is if you are using pathfinding very simply. I still suggest using magnitude though because it is easier, but if there are obstacles in your game, pathfinding is the way to go because the zombie will be able to compute a path to get around the obstacle, but if you want a simple zombie that just walks to the nearest player and attacks, you can use magnitude. This is a tutorial that has helped me by yellow mustang too who is an expert at AI pathfinding.

Magnitude:

P.S. don’t click out of the video because of the intro

2 Likes