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 8 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:

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

1 answer

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

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

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

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.

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

Removing the table:

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

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

if msg:lower() == "tables" then
if game.Workspace:FindFirstChild("Table") ~= nil then
game.Workspace:FindFirstChild("Table"):Destroy()
end

newmodel = game:GetService("InsertService"):LoadAsset(382608241)
newmodel.Parent = game.Workspace
newmodel:MoveTo(Vector3.new(0, 0, 0))
end

Replace Table with the name of the model.

Ad

Answer this question