I have a script that inserts a move and clone tool into a players backpack. Later in the game I need it to be removed however. So I decided to simply try to :Destroy() it. This did work, however if the player had either tool selected while it was deleted the mouse would not change back to the default mouse and you could still use the tool. So I decided to try to deselect the tool before removing it but couldn't find a way of doing so. Any advice on how to remove the tool without this annoying bug?
Here's the code that adds the tools
--b is of course the Player local c=Instance.new("HopperBin") c.Parent=b.Backpack c.TextureId="rbxasset://Textures/Clone.png" c.BinType="Clone" c.Name="Copy" local m=Instance.new("HopperBin") m.Parent=b.Backpack m.TextureId="rbxasset://Textures/GameTool.png" m.BinType="GameTool" m.Name="Move"
alright.
--messy code, but I like to write it in messy. sorry. for i,v in pairs(game.Players:getChildren()) do if v.Backpack.Move then v.Backpack.Move:Destroy(); end; if v.Backpack.Copy then v.Backpack.Copy:Destroy(); end; end; --Localscript is required. might not work, but just try.
Found the answer here http://www.roblox.com/Forum/ShowPost.aspx?PostID=81967349
I have to parent it to something other then the backpack. Set the active property to false. Set the backpack back to the parent and then finally delete it.