The intended purpose of this script is to spawn the “Shade” Entity in the game through Replicated storage, however when I run the script, nothing happens and the entity is not cloned and inserted into the game.
CODE: > local limit = 10
local replicate = script.Parent
local min = .5
local max = 2
local characterInfo = {
maxhp = 100,
walkspeed = 16
}
local monster = replicate.Shade:Clone()
for i = 1, limit do
local enemy = monster
local humanoid = monster.Humanoid
local scale = math.random() * (max - min) + min
humanoid.BodyHeightScale = scale
humanoid.BodyWidthScale = scale
humanoid.BodyDepthScale = scale
monster.Parent = workspace
for p, v in pairs(characterInfo) do
humanoid[p] = v
end
end
(I’ve tried parenting the newly cloned Model into workspace.)
Make sure this script is a server script, located in workspace or ServerScriptService.
Also make sure that the model is Archivable, or else it won’t clone.
Also-Also, I think you’re trying to spawn multiple enemies.
If so, I’d suggest moving the clone statement into the loop, instead of cloning outside of the loop:
local monster = replicate.Shade
for i = 1, limit do
local enemy = monster:Clone() -- clone the monster
local humanoid = enemy.Humanoid
-- ...
enemy.Parent = workspace
end