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
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").