How remove a specific tool name for all user on a game?

Hello everyone , i am trying to make a script who can remove a tool named “Jerrycan” from the basic inventory of roblox for all user on a game at a specific time but that not actually working… could someone can help me pls ?

This?

Local plrBack= game:GetService(“Players”).LocalPlayer.Backpack
 Local jerry = plrBack:WaitForChild(“jerrycan”) 
if jerry:IsA(“Tool”) then
jerry:Destroy()

end
end)

Sorry for any errors, I am on a tablet.

no they want to remove it from all players, so you want to loop through game.Players

I think

Script in ServerScriptService

local Players_Storage = game:GetService("Players")

for _, Child in pairs(Players_Storage:GetChildren())do
	local Character = Child.Character
	local Backpack = Child:WaitForChild("Backpack" ,5)
	
	if Character ~= nil and Character:FindFirstChild("Jerrycan")then
		Character.Jerrycan:Destroy() --Destroy when item is equiped
	end

	if Backpack ~= nil and Backpack:FindFirstChild("Jerrycan")then
		Backpack.Jerrycan:Destroy() --Destroy when item is in backpack
	end
	
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.