✓ Accepted answer
#Edit: I misunderstood the question, OP wanted to pick a random model and clone it to the workspace.
Remember to put your models in either a folder named Models or a group named Models:
clicker = script.Parent
clicker.ClickDetector.MouseClick:Connect(function(player)
local models = game.Lighting.Models:GetChildren()
local randomModel = models[math.random(1, #models)]
local modelClone = randomModel:Clone()
modelClone.Parent = game.Workspace
end
#Old post:
this should work if you want to make the click events for a bunch of parts but don't want to create the events individually
You can do all this in one script by using loops:
Put all your clickers and your objects in a table, then you can have the loop create click events for the items in the clickers table.
workspace.Clicker1, workspace.Clicker2, workspace.Clicker3
}
objects = {
game.Lighting.Object1,
game.Lighting.Object2,
game.Lighting.Object3
}
for i = 1, i < #objects do
clickers[i].ClickDetector.MouseClick:Connect(function(player)
objects[i]:Clone().Parent = game.Workspace
end)
end