Still have questions? Join our Discord server and get real time help.
Log in to vote

How do we Clone all children and position then in a random spawn position in a folder?

Asked by 2 months ago
Edited 2 months ago
local SpawnedGuns = game.Workspace.Gunspawned
local gunSpawns = game.Workspace.GunSpawns:GetChildren() 
local gunsToSpawn = game.ServerStorage.Guns:GetChildren()

local CloneGuns = gunsToSpawn:Clone()
CloneGuns.Parent = SpawnedGuns
CloneGun.Position = math.Random("gunSpawns").Position 

--But I don't know whats wrong with this peace of code how do I fix it?

1 answer

Log in to vote
Answered by 2 months ago

Your ("gunSpawns") should be

math.Random[gunSpawns]Position -- Do not include the quotations.
@Xx0966xX this is probably the solution to your problem. if it is, please mark this question as "Answered" by this person ^ Avoxea 43 — 2mo

Answer this question