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

How do I go about inserting :Remove() in this script?

Asked by
Resnex 60
10 years ago

Hello, scripting helpers! I appear to be having a problem with my script. I'm attempting to have it so Model (as shown in the gyazo) will be removed after GunChosen is cloned into the player's backpack. The tools ARE being cloned, but it's not removing Model. Here, I gave you the script without the :remove(), where should I place :remove()?

http://gyazo.com/8187828c52a773833b9df33f504221c1

--[[
Ran1 = HPW-12
Ran2 = PDWMP
Ran3 = R-C12 Carbine
Ran4 = ScarV3
Ran5 = Scarab
Ran6 = X-12 Platform
Ran7 = X-9 LMG
--]]

script.Parent.DialogChoiceSelected:connect(function(player, choice)
if (choice == script.Parent.Choice1) then

wait()

if script.Parent.Ran1.Value == true then
local GunChosen = game.Lighting["HPW-12"]:clone()
GunChosen.Parent = player.Backpack


elseif script.Parent.Ran2.Value == true then
local GunChosen2 = game.Lighting["PDWMP"]:clone()
GunChosen2.Parent = player.Backpack

elseif script.Parent.Ran3.Value == true then
local GunChosen3 = game.Lighting["R-C12 Carbine"]:clone()
GunChosen3.Parent = player.Backpack

elseif script.Parent.Ran4.Value == true then
local GunChosen4 = game.Lighting["ScarV3"]:clone()
GunChosen4.Parent = player.Backpack

elseif script.Parent.Ran5.Value == true then
local GunChosen5 = game.Lighting["Scarab"]:clone()
GunChosen5.Parent = player.Backpack

elseif script.Parent.Ran6.Value == true then
local GunChosen6 = game.Lighting["X-12 Platform"]:clone()
GunChosen6.Parent = player.Backpack

elseif script.Parent.Ran7.Value == true then
local GunChosen7 = game.Lighting["X-9 LMG"]:clone()
GunChosen7.Parent = player.Backpack

end
end
end)

1 answer

Log in to vote
0
Answered by 10 years ago

Easy.

Player:FindFirstChild('Backpack'):ClearAllChildren()
Ad

Answer this question