repeat wait() until game.Workspace:FindFirstChild("WinerMessage")~= nil player = game.Players:GetChildren() for i,v in pairs(player) do local playercharacter = v.Character if game.Workspace:FindFirstChild("WinerMessage")~= nil then playercharacter.Humanoid.LocalBin:Destroy() end end
my code ^ -- it wont delete the local parts. i made a script that gives local parts to all the players. i want the local parts to be destroyed if something called 'WinerMessage' pops up in workspace. so basically if a message pops up in workspace names WinerMessage all the local parts should get destroyed all the local parts from each player. i place my local parts in players humanoid. is there a way to delete them?
game.Workspace.ChildAdded:connect(function(object) if object.Name == "WinerMessage" then for i,plr in pairs(game.Players:GetChildren()) do if plr and plr.Character and plr.Character:FindFirstChild("Humanoid") ~= nil and plr.Character.Humanoid:FindFirstChild("LocalBin") then plr.Character.Humanoid.LocalBin:Destroy() end end end end)
I have no access in studio to test this but it should work fine. If anything is added to workspace then it will destroy it if the name is "WinerMessage" By the way, you spelt winner incorrectly.