this is what i have so far
script.Parent.Touched:connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then local player = game.Players:FindFirstChild(hit.Parent.Name)
for i=1, 1 do
for i,v in pairs(game.Players:GetPlayers()) do for a,b in pairs(v.Character:GetChildren()) do if b:IsA("Tool") or b:IsA("HopperBin") then b:Destroy()
end end end end v.Backpack:ClearAllChildren() end end)
in this script every item gets destroyed so far i knowe. I'm a big noob on coding so I hope someone can help me.
Item that i want to remove from players inventory is called "Blue Master Key"
function onClicked(Plr) local Char = Plr.Character if Char:FindFirstChild("Blue Master Key", true) then Char:FindFirstChild("Blue Master Key", true):Destroy() -- Removes tool from players hands end if Plr.Backpack:FindFirstChild("Blue Master Key", true) then Plr.Backpack:FindFirstChild("Blue Master Key", true):Destroy() -- Removes tool from players backback end end
Hello, kexiGamer!
This script completly removes the key from the player! Removes from player hand and player inventory =D
Hope you like it!
script.Parent.Touched:connect(function(hit) local Humanoid = hit.Parent:FindFirstChild("Humanoid") if Humanoid then for i,item in pairs(hit.Parent:GetChildren()) do if item.Name == "Blue Master Key" and item:IsA("Tool") then item:Destroy() end end for i,item in pairs(game.Players[hit.Parent.Name].Backpack:GetChildren()) do if item.Name == "Blue Master Key" and item:IsA("Tool") then item:Destroy() end end end end)
Good luck with your games!
Hi there and thanx for your answer I get: "Request was throttled. Try sending fewer requests. Key = 551800471 (x4) " and (x4) is just growing and growing. No item dissapears from inventory.
Here is my the script that is working but it is not removing only "BlueMasterKey" tool. It is clearing whole inventory.
function onClicked() for i=1, 1 do-----while wait(5) can allso be used and it is working (all other script that i tryed here seems not to work) for i,v in pairs(game.Players:GetPlayers()) do for a,b in pairs(v.Character:GetChildren()) do if b:IsA("Tool") or b:IsA("HopperBin") then b:Destroy() end end v.Backpack:ClearAllChildren() end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Is it possible to start script like this and continue writing so only the "Blue Master Key" gets removed from inventory?
function onClicked() for i=1, 1 do -------ADD CODE TO ONLY REMOVE "Blue Master Key" ----> end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I realy aprishiate your help and time!