You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
To Make The Script Spawn The Npcs On The Terrain And Not In The Middle Of Nowhere -
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve done everything I can, nothing works
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local npcModel = game.ServerStorage.noob
local function cloneNPC()
local terrain = workspace.Terrain
local terrainSize = terrain.Size
local posX = math.random(0, terrainSize.X)
local posZ = math.random(0, terrainSize.Z)
local posY = math.random(0, terrainSize.Y)
local cellX = math.floor(posX / 4)
local cellZ = math.floor(posZ / 4)
local cellY = math.floor(posY / 4)
local spawnPosition = Vector3.new(posX, posY, posZ)
local npcClone = npcModel:Clone()
npcClone.Parent = workspace
npcClone:PivotTo(CFrame.new(spawnPosition))
end
while true do
wait(1)
cloneNPC()
end
All i ask is for a quick fix to this script, cause idk what to do