When spawning a monster (zombie), I want to direct it. [Help!]
( ex Production image )
When a monster (zombie) spawns under the ground, it comes up and tries to attack the player.
However, only 1 is produced as intended, and the rest of the monsters (zombies) disappear into the ground without production. I need help!
- I used Google Translate. Please understand.
The method I used is collision groups. (CollisionGroupSetCollidable)
GroupList = { Defluat ,NotCollied , enemy , player}
- Zombie default = enemy
- When directing, zombie default = NotCollied
- At the end of production, zombie default = enemy
Repeat 1 → 2 → 3 above.
However, starting with the second zombie, it disappears into the ground.
Is there a way to direct when a zombie is summoned?
–:: When spawning a monster (zombie), I want to direct it. [Help!]
When a monster (zombie) spawns under the ground, it comes up and tries to attack the player.
However, only 1 is produced as intended, and the rest of the monsters (zombies) disappear into the ground without production. I need help!
- I used Google Translate. Please understand.
The method I used is collision groups. (CollisionGroupSetCollidable)
GroupList = { Defluat ,NotCollied , enemy , player}
- Zombie default = enemy
- When directing, zombie default = NotCollied
- At the end of production, zombie default = enemy
Repeat 1 → 2 → 3 above.
However, starting with the second zombie, it disappears into the ground.
Is there a way to direct when a zombie is summoned?
※ When creating a zombie, script
local dd = game.Workspace.Npc
function Stat(part)
for i = 1 , 10 do
if NPC then
local Clone = NPC:Clone()
Clone:SetPrimaryPartCFrame( SpawnPoint.CFrame )
wait( Clone )
PhysicsService:CollisionGroupSetCollidable( "NotCollied" , 'Default', false)
for _, parts in pairs( Clone:GetDescendants()) do
if parts:IsA('BasePart') or parts:IsA('MeshPart') then --or parts:IsA('Part') then
print("[Server] - Physics Service Loaded! Collision Group.. NPC!")
PhysicsService:SetPartCollisionGroup( parts , "NotCollied")
end
end
Clone.Parent = dd --Monster
end
wait( SpawnCoolTime )
end
end
※ Script upon completion of zombie production.
local boxes = not script.Parent:FindFirstChild("IgnoreBoxes")
local players = not script.Parent:FindFirstChild("IgnorePlayers")
local speed = script.Parent:FindFirstChild("Speed") and script.Parent.Speed.Value or 40
local Chack = false
function END(part)
if not Chack then
local torso = part.Parent:FindFirstChild("Torso") or part
if not torso:FindFirstChild("ElevatorVelocity") and (part.Parent:FindFirstChild("Humanoid") and players) or (part.Name == "PushBox" and boxes)
and not (script.Parent:FindFirstChild("Activated") and not script.Parent.Activated.Value) then
local velocity = Instance.new("BodyVelocity", torso)
velocity.Name = "ElevatorVelocity"
local uv=script.Parent.CFrame.UpVector
local maxf=Vector3.new(0,math.huge,0)
if uv.X ~= 0 then maxf = Vector3.new(math.huge, maxf.Y, maxf.Z) end
if uv.Z ~= 0 then maxf = Vector3.new(maxf.X, maxf.Y, math.huge) end
velocity.MaxForce = maxf
velocity.Velocity = script.Parent.CFrame.UpVector* 3 --speed
end
end
end