Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
svjatik4 -13
4 years ago

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

Closed as Not Constructive by JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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.

Ad