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

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

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?

2 comments

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-

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.

1 answer

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

2 comments

0

Thanks!

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.

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