How to Create and Destroy Enemies in Roblox Studio #fb_roblox 23


How to Create and Destroy Enemies in Roblox Studio #fb_roblox 23

In this post I'm going to show you how to make enemies spawn in different places on the map in Roblox Studio, and how to destroy those enemies through Mouse Click.

Video Topics

1 – How to spawn enemies in Roblox Studio

Enemies will spawn in portals scattered in different places on the map.

local covirus = game:GetService("ServerStorage").CovirusHuman local temp = game:GetService("Debris") while(true) do wait(5) local novoCovirus = covirus:Clone() portal = math.random(1,4 ) if(portal == 1) then newCovirus.Humanoid.RootPart.Position = workspace.Portal1.Position elseif(portal == 2) then newCovirus.Humanoid.RootPart.Position = workspace.Portal2.Position elseif (portal == 3) then novoCovirus.Humanoid.RootPart.Position = workspace.Portal3.Position elseif (portal == 4) then novoCovirus.Humanoid.RootPart.Position = workspace.Portal4.Position end novoCovirus.Parent = workspace temp:AddItem(novoCovirus,500) end

2 – Sound Effect on Enemy

How to make enemies emit a sound when someone touches them.
In our case, we made the enemy emit a sneeze sound every time he touches a humanoid

local instance = script.Parent somatocar = Instance.new("Sound", script.Parent) somaotocar.SoundId = "rbxassetid://1066812207" local control = true local function toplay(part) human local = part.Parent:FindFirstChild( "Humanoid") if human and control then control = false somatocar:Play() wait(5) control = true end end instance.Touched:Connect(playing)

3 – How to Destroy the Enemies

In our example we are going to destroy enemies just by clicking on it.
Calm down, but it's not that simple, we can only destroy enemies when he's very close, otherwise it's very easy, right.

local clickd = script.Parent.ClickDetector local clickMaximum = 20 -- 20 yards for NPC to chase Local player clickMinimum = 0 -- 5 minimum distance for bot to stop function onClick() repeat wait() until game.Players.NumPlayers >= 1 -- wait until the number of players is greater than 1 or equal local NPC = script.Parent local NPCHumanoidRoot = NPC.HumanoidRootPart local NPCHumanoid = NPC.Humanoid for i,v in pairs(game.Players:GetPlayers() ) do -- Get player list repeat wait() until v.Character -- Wait for player character -- Object destruction if (v.Character.HumanoidRootPart.Position - NPCHumanoidRoot.Position).Magnitude <= clickMaximo and ( v.Character.HumanoidRootPart.Position - NPCHumanoidRoot.Position).Magnitude >= clickMinimo then clickd.MouseClick:connect(function() NPC:Destroy() end) end end end while wait() do onClick() end

How to create roblox enemies, how to spawn roblox enemies, how to span roblox enemies, how to destroy roblox enemies, how to create and destroy roblox enemies, how to create roblox npc, how to create enemies at different points in roblox, how to spawn enemies in roblox, how to spawn part roblox, how to create random roblox enemies, how to make roblox enemies, how to insert music into roblox enemies, music at npc roblox


Fabio Bmed on Social Media


Fabio Bmed no Youtube

Fabio Bmed no TikTok

Fabio Bmed no Facebook

Fabio Bmed no Instagram

Fabio Bmed na Twitch

Fabio Bmed no Twitter

 186 Total Views, 2 Views Today