so i made a script that chooses a random monster in the game and clones it and puts it in the workspace. but it only chooses shrek and says: "attempt to index local 'monster' (a number value)" help please ?
local h = Instance.new("Hint") h.Parent = workspace h.Text = "" function choosemonster() local monsters = game.ReplicatedStorage.Monsters:GetChildren() local monster = math.random(1,#monsters) local wmonster = monsters[monster]:Clone() wmonster.Parent = workspace wmonster.Name = "Monster" h.Text = "Monster Chosen:"..monster.Name end function removemonster() if workspace.Monster ~= nil then workspace.Monster:Destroy() end end while wait() do h.Text = "Choosing Monster..." wait(5) choosemonster() wait(120) removemonster() h.Text = "The monster has disappeared..." wait(3) end