Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a spawner so that when you press the button, the model spawns?

how to make a spawner. So that when you press the button, the model spawns in this place that I left in roblox studio? Help pls

1 answer

Here is a little example, it works but it has no debounce and other stuff, it's just to show you how it works. 'carModel' is object we will be cloning when the spawner is clicked.

local spawner = "Button you want to press"
local clickDetector = spawner.ClickDetector
local carModel = workspace.Car -- Example object you want to clone

clickDetector.MouseClick:Connect(function() -- When cd is clicked

	local newCar = carModel:Clone() -- Clone the car
	newCar.Parent = workspace -- Set it's parent
end)

To spawn the car in some points you will need to create the point:

local spawnPoint = workspace.SpawnPoints -- example
local spawnPointsCFrame = spawnPoints.CFrame -- cframe of spawn points

local modelPrimaryPart = car.PrimaryPart -- If you want to move model, you need it's primary part (it's in properties of the model), if it's just a part then you just set part.CFrame

modelPrimaryPart.CFrame = spawnPointsCFrame

Again this is example, this script is not perfect but you can see how it works.

This discussion is preserved as it was. New answers, comments, and votes are closed.