Make a script that delete all basketballs that is in the workspace

–[[
24k
enjoy lol
]]–

local function Chat(plr,msg) --Heres our Chat function
local char = plr.Character or plr.CharacterAdded:wait()
local humanoid = char:WaitForChild(‘Humanoid’)

while true do
if char:FindFirstChild(“PracticeBall”) then --removes spams–
wait()
break
else
if msg:lower() == “bb” then --If the Player types ‘bb’ then
if game:FindFirstChild(“ServerStorage”) and game.ServerStorage:FindFirstChild(“PracticeBall”) and plr and plr:FindFirstChild(“Backpack”) then --This will check to see if ServerStorage, Pass/Shoot, The Player, and the Player’s Backpack are existant
local GiveTool = game.ServerStorage[“PracticeBall”]:Clone() --This will clone the object
GiveTool.Parent = plr.Backpack
humanoid:EquipTool(GiveTool)
end --This ends the code for the second ‘if’ statement
end --This ends the code for the first ‘if’ statement
break
end
wait()
end

end --This ends the code for the ‘Chat’ function

game.Players.PlayerAdded:connect(function(plr) --Heres the PlayerAdded event; This will fire everytime a Player joins; The Player whom has joined will be identified as ‘plr’
plr.Chatted:connect(function(msg) Chat(plr,msg) end) --This connects the Player’s Chat to the ‘Chat’ function
end) --This ends the code for the ‘PlayerAdded’ event

Thats the bb script for the practice ball

You shouldn’t write code with ChatGPT as it doesn’t understand Roblox Luau that well. But I will try to see if there is anything wrong.

Thats not chatgpt script its a model of mine i only used chat gpt for the clear script as you can see my name is in the script.

Have you tried this code that was posted yet?

Objecttype has a blue line under it

Ok, whatever you say, but just because you put your name in the script doesn’t mean you used an ai.

Try this and let me know if it doesn’t work:

local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")
local PractiseBall = ServerStorage:WaitForChild("PractiseBall")
local Debounce = false

local function Chat(Player, Message) --Heres our Chat function
	local Character = Player.Character or Player.CharacterAdded:Wait()
	local Backpack = Player.Backpack
	local humanoid = Character:WaitForChild("Humanoid")
	local LowerCaseMessage = string.lower(Message)

		if Backpack:FindFirstChild("PractiseBall") or Debounce then
			return false
		else
			if LowerCaseMessage == "bb" then 
				if Player then
				local ClonedTool = PractiseBall:Clone() 
				ClonedTool.Parent = Backpack
				humanoid:EquipTool(ClonedTool)
				Debounce = true
			end 
		end 
	end
end 

Players.PlayerAdded:Connect(function(Player) 
	Player.Chatted:Connect(function(Message) 
		Chat(Player, Message)
	end) 
	
	Player.CharacterAdded:Connect(function(Character)
		local Backpack = Player.Backpack
		Backpack.ChildRemoved:Connect(function(Child)
			if Child:IsA("Tool") and Child.Name == "PractiseBall" then
				Debounce = false
			end
		end) 
	end)
end)

you are supposed to replace objecttype with what type your object is.

For example, if your object type is a folder, then you would do isA("Folder") or if your object type is a tool, then you would do isA("Tool").

Since you are trying to get all of the tools named “PracticeBall” inside of workspace, you would replace this line of code v:IsA(objecttype) with v:IsA("Tool").

1 Like

This for the bb script or the clear/ delete ball script

this is for the bb script, try it out.

i just made a script that deleted all things in a folder once 60 seconds (red studs) created by another script