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

How do I spawn a model in a certain place with a button?

Asked by 9 years ago

I have a certain place I'd like a model to spawn when I click a button, and if I click another button, or the same button, it will leave. Do I put it in Server Storage or Lighting?

0
It is safer to place any type of Model/Part/ect. into the 'ServerStorage' service for a Server, because, Lighting was NEVER in the first placed supposed to be used to contain items, except a 'Sky' instance, and allows exploiters to get the Guns/Models/ect. you only want to be taken when you want it to be taken by a certain task (like an RPG), while, ServerStorage is a lot safer, where it'll only- TheeDeathCaster 2368 — 9y
0
-Only Replicate to the Server (Regular Script), and not a Client (Meaning LocalPlayer, and will not return the service within a 'LocalScript'), so, 'ServerStorage' is  safer to use, and is most recommended to use now. TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago

I haven't tested this out, but it should work.

script.Parent.MouseButton1Click:connect(function()
    if game.Workspace:FindFirstChild("Model") then--Change model to the model name
        game.Workspace.Model:Destroy()--Destroys entire model from workspace
    else
        local clone = game.ServerStorage.Model:Clone()
        clone.Parent = game.Workspace
    end
end
0
Thanks! Kreative4Life 0 — 9y
1
Please do not simply post code, it does not help the user to understand the reasoning behind your Answer. Also, this Question is simply a 'Should I put it in Lighting or ServerStorage', meaning as it says, to put the Model inside the ServerStorage or Lighting. TheeDeathCaster 2368 — 9y
Ad

Answer this question