I am kinda confused, as I am new at it.
Quick tip for LocalScripts > Scripts.
Script
- This is for the Player or objects, it can be used is things a colour changing brick or if you’re aiming something at the player.
Local Script
- This is aimed at all players, this can be used for things such as GUI’s or Rank Doors.
Ah! Thank you, Oreo!
Do you know how to make a table in lua?
If so read this.
Then try making a table with all the names of the items you don’t want deleted.
Okay! Will do. (hcjgxkjsdu)
local donotDelete = {"Investor", "First Class", "Business", "Economy"}
local MinPercentage = 70
local MinRole = 32
local GroupId = 8873606
local Characters = 0
local UppercaseCharacters = 0
local Percentage = 0
local WarnFunction = game:GetService("ReplicatedStorage").WarningSystem:WaitForChild("Warn")
local function Punish(player)
local Punishment = WarnFunction:InvokeClient(player)
Characters = 0
Percentage = 0
UppercaseCharacters = 0
end
local function CheckWord(String, player)
for _, v in ipairs(String:split("")) do
Characters += 1
if v ~= v:lower() then
UppercaseCharacters += 1
end
end
local Percentage = math.floor((UppercaseCharacters)/(Characters) * 100)
if Percentage >= MinPercentage then
Punish(player)
end
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(text)
if player:GetRankInGroup(GroupId) <= MinRole then
CheckWord(text, player)
end
end)
end)
This isn’t the right code, is it?
This is the ServerScript (As I said, I am sorry, I am new with tables)
Oh! Lol, I did the warn command one. I am an idiot. LOL.
Changing… (adsfnsafhuijcn)
local CanNotDelete = {"Investor", "First Class", "Business", "Economy", "Passport", "Suitcase"}
local DeleteItems = game.ReplicatedStorage.BinSystem:FindFirstChild("Bins")
DeleteItems.OnServerEvent:Connect(function(player)
for i, v in ipairs(player.Backpack:GetDescendants()) do
v:Destroy()
end
end)
Great!
Now, we need to loop through the table, we can do this with a forloop.
Then we can say, if the name doesn’t match, then we don’t destroy.
local CanNotDelete = {"Investor", "First Class", "Business", "Economy", "Passport", "Suitcase"}
local DeleteItems = game.ReplicatedStorage.BinSystem:FindFirstChild("Bins")
DeleteItems.OnServerEvent:Connect(function(player)
for i, v in ipairs(player.Backpack:GetDescendants()) do
for i, v in pairs (DeleteItems ) do
if v ~= Tool.Name then
v:Destroy()
end
end
end
end)
Try something like this.
Tool is an unknown global.
local CanNotDelete = {"Investor", "First Class", "Business", "Economy", "Passport", "Suitcase"}
local DeleteItems = game.ReplicatedStorage.BinSystem:FindFirstChild("Bins")
DeleteItems.OnServerEvent:Connect(function(player)
for i, v in ipairs(player.Backpack:GetDescendants()) do
for i, x in pairs (DeleteItems ) do
if v ~= x then
v:Destroy()
end
end
end
end)
Try this.
The notification doesn’t pop up-
Have you edited any of the other scripts?
No, but the script is different from the video and the post
Let me just test it in studio!
Try this:
local CanNotDelete = {"Cookie"}
local DeleteItems = game.ReplicatedStorage.BinSystem:FindFirstChild("Bins")
DeleteItems.OnServerEvent:Connect(function(player)
for i, v in ipairs(player.Backpack:GetDescendants()) do
for x, c in pairs (CanNotDelete) do
if tostring(c) ~= tostring(v) then
v:Destroy()
end
end
end
end)