Random Rolling system For Spawning an NPC

I am currently making a rolling system that if you roll say a “Normal Zombie” It will spawn a Normal Zombie currently I am stuck in some code. I am a beginner coder so please don’t Judge me.


The “Normal Zombie” Model is in Workspace.

If you need anymore questions about where I have put anything be free to ask

2 Likes

what exactly happens when the normal zombie spawns? do you get an error in the output window or something?

So basically nothing at all spawns there are no errors in the script which is why I came to devforum

If it helps this is how I am randomly choosing an npc to spawn. Also you can see where I put the “Normal Zombie” Model

maybe try changing the CFrame of the HumanoidRootPart of the zombie like HRP.CFrame = CFrame.new(-23.852, 0.5, 19.13)? also, the zombie’s parent is already Workspace so no need to set it’s parent again, unless you intend on moving it elsewhere (like ReplicatedStorage or ServerStorage)

also try printing RollResult to make sure it’s actually Normal Zombie and not normal Zombie or NormalZombie or something

Quick tip for you as you’re a begninner:
You do NOT need to :WaitForChild() on the server as all the instances load together on the server as opposed to the client!

1 Like

BTW I had to go to sleep which is why this is a late reply but does the HRP.CFrame go into where it used to be like this?

Although it does come up with an error in the HRP. CFrame so i am not sure that is correct, btw thank you for being patient with me

sorry, i should’ve clarified, HRP stands for HumanoidRootPart. if you change the CFrame of the HRP, it moves the entire rig (character). so newZombie.HumanoidRootPart.CFrame is what you want to do

1 Like

So like this?

It still doesn’t work, it does not come up with any errors. It probably has something to do with the parenting

also try printing RollResult to make sure it’s actually Normal Zombie and not normal Zombie or NormalZombie or something

try doing this then

I made sure that everything is “Normal Zombie” But I found something, the “print"A Normal Zombie has appeared!” Does not get printed to the output so I am testing if the roll function (in replicated Storage) even gets fired.