Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years 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
1
Answered by 4 years ago

Your ("gunSpawns") should be

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

Answer this question