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

Is there a way to insert and remove a model multiple times over in one session?

Asked by 9 years ago

Hi! I've been struggling for days on this issue: I own a Roblox Wrestling company and need breakable tables to be able to insert into the game around our wrestling ring when I (or my fellow admins) command it. I'm using Khol's Admin V2 and have put in my own part of it trying to do this but it doesn't work. I not only need this for the tables, but for other models as well so if someone could help me out to be able to fit into Khol's Admin V2 commands for the admins and I for any model I'd like at any position on the level that I'd like from one command to spawn and one command to despawn (and all over again if I need to), that would be very helpful!

This is what I've tried so far. If you have any questions, please message me on ROBLOX.com, I really would like to get this resolved as soon as possible. Thanks!

What I tried to spawn the model:

1if msg:lower() == "tables" then
2newmodel = game:GetService("InsertService"):LoadAsset(382608241)
3newmodel:MoveTo(Vector3.new(0, 0, 0))

1 answer

Log in to vote
2
Answered by
Acheo 230 Moderation Voter
9 years ago

You need to parent the model when you're using this approach.

1if msg:lower() == "tables" then
2newmodel = game:GetService("InsertService"):LoadAsset(382608241)
3newmodel.Parent = game.Workspace
4newmodel:MoveTo(Vector3.new(0, 0, 0))
5end

Also, I recommend replicating (copying) the table from ReplicatedStorage rather than insering it. Another thing is, you need to be aware that this model is indeed free to access, otherwise you cannot use it in your game.

1if msg:lower() == "tables" then
2newmodel = game.ReplicatedStorage:FindFirstChild("Table"):clone()
3newmodel.Parent = game.Workspace
4newmodel:MoveTo(Vector3.new(0, 0, 0))
5end

Removing the table:

1if msg:lower() == "no tables" and game.Workspace:FindFirstChild("Table") ~= nil  then
2game.Workspace:FindFirstChild("Table"):Destroy()
3end

Replace "Table" with the name of the inserted object.

Replacing the table: I was thinking maybe I misunderstood the question so here's another view of what you MAY be asking for

1if msg:lower() == "tables" then
2if game.Workspace:FindFirstChild("Table") ~= nil then
3game.Workspace:FindFirstChild("Table"):Destroy()
4end
5 
6newmodel = game:GetService("InsertService"):LoadAsset(382608241)
7newmodel.Parent = game.Workspace
8newmodel:MoveTo(Vector3.new(0, 0, 0))
9end

Replace Table with the name of the model.

Ad

Answer this question