I'm trying to make a randomize cube picker and it spawns randomly were the CubePlaces CFrame are, But it didnt work.
The output said something about an nil value.
local CubeDisplays = game.ReplicatedStorage.CubeDisplay:GetChildren() local CubePlaces = game.Workspace.CubePlaces:GetChildren() local CubePlacesPart = game.Workspace.CubePlaces CubeDisplay = math.random(1, #CubeDisplay) CubeChosen = CubeDisplay[CubeDisplay] CubeChosen:Clone().Parent = game.Workspace CubeChosenClone = CubeChosen:Clone() CubeChosenClone.Parent = game.Workspace CubePlace = math.random(1, #CubePlaces) CubeChosenClone.CFrame = CubePlace.CFrame
Here's a fix, it should work :
local CubeDisplays = game.ReplicatedStorage.CubeDisplays:GetChildren() local CubePlaces = game.Workspace.CubePlaces:GetChildren() local CubePlacesPart = game.Workspace.CubePlaces CubeDisplays = math.random(1, #CubeDisplays) CubeChosen = CubeDisplays[CubeDisplays] CubeChosen:Clone().Parent = game.Workspace CubeChosenClone = CubeChosen:Clone() CubeChosenClone.Parent = game.Workspace CubePlace = math.random(1, #CubePlaces) CubeChosenClone.CFrame = CubePlace.CFrame
You forgot the "s" after "CubeDisplay".
I'm not sure why, but to fix it just put
math.randomseed(tick())
before you use math.random