I have this short script here that I want to use to remove a certain tool. But the problem is if the player has it enabled it won't be removed. Is there a way to access what they have selected?
Here's the script:
first_infected.StarterGear.Shrike:remove() first_infected.Backpack.Shrike:remove()
Thanks!
Tools, when equipped, are moved into the player's character.
Just check there, too (I'm unsure if deleting an equipped tool might have bad effects)
place = first_infected.StarterGear; if place:FindFirstChild("Shrike") then place.Shrike:Destroy() end place = first_infected.Character; if place:FindFirstChild("Shrike") then place.Shrike:Destroy() end
This solution may fix the problem you saw:
place = first_infected.StarterGear; if place:FindFirstChild("Shrike") then place.Shrike:Destroy() end place = first_infected.Character; if place:FindFirstChild("Shrike") then local tool = place.Shrike; tool.Enabled = false; tool:Destroy() end
place = first_infected.Character; if place:FindFirstChild("Shrike") then place:FindFirstChild("Shrike").Parent = first_infected.Backpack wait() v.Backpack.Shrike:Destroy() end
It removes it to the backpack from where I can destroy it.