I'm trying to make it so if you're on the team Criminal and you have the items Taser or HandCuffs in your backpack, it gets removed. I tried doing this but it didn't work.
local players = game:GetService("Players") local criminals = game.Teams.Criminal players.PlayerAdded:Connect(function(player) player.Team = criminals player.CharacterAdded:Connect(function(character) character.Humanoid.Died:Connect(function() if player.Team == criminals then while true do game.Players.LocalPlayer.Backpack.Taser:Destroy() game.Players.LocalPlayer.Backpack.HandCuffs:Destroy() end end end) end) end)
It would be better if you added a StringValue on the player to tell which team he is on instead of just getting it from the Team Service, I'm guessing that script is in the StarterGui, so try this:
wait(1) Player = workspace:FindFirstChild(script.Parent.Parent.Name) if not Player:FindFirstChild("Team") then local value = Instance.new("StringValue") value.Name = 'Team' value.Parent = Player end wait() if Player.Team.Value ~= "Criminal" then wait() else if script.Parent.Parent.Backpack:FindFirstChild("Taser") and script.Parent.Parent.Backpack:FindFirstChild("HandCuffs") then script.Parent.Parent.Backpack.Taser:Destroy() script.Parent.Parent.Backpack.HandCuffs:Destroy() else wait() end end print 'script done' --after the script is done, just go to the Player on the Workspace and change the Team value to Criminal, see if it works.