I want to make a button that has a clickdetector that can spawns a random model, but literally theres nothing on how to do it, can anyone tell me a script that tells me that's recent? Edit: to be more clear, I need a script that spawns a random Model out of many from ReplicatedStorage to a part shows where the models spawn, but unfortunately I am unable to find one
COMMUNITY QUESTION
Multiple model spawner with clickdetector failiure. Does anyone know how to do this?
1 answer
Before writing this script, you muse have a PrimaryPart set for your model in order to move it to any position and place your model in ServerStorage for safe keeping
ServerStorage = game:GetService('ServerStorage') -- getting the ServerStorage
model = ServerStorage:WaitForChild('Model') -- refrencing your model
ClickDetector.MouseClick:connect(function()
local GoalPosition = part.Position -- Set this variable as the part position where you want your model to spawn in
local ModelClone = model:Clone() -- Cloning the model that you want to spawn in
ModelClone.Parent = workspace -- placing the model onto workspace
ModelClone:MoveTo(GoalPosition) -- Placing your model to the position that you want
end)
2 comments
0
Abusedcocopuff4, where do i put the script and what should I name the part that positions it
0
You can put the script inside the click detector and name the part to whatever you want.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Could you go into a little more detail? So far my understanding is you want to be able to click on the clickdetector and have multipe (more than 1) models spawn in. Where do you want these models to spawn in? where are you storing these models?
I edited it to be more clear u should relook if u want