I’m trying to detect when a tool in the workspace is touched using a TouchTransmitter, but it won’t work.
Here’s the script:
local ball = script.Parent
local handle = ball.Handle
local touchTransmitter = handle.TouchInterest
local Players = game:GetService("Players")
touchTransmitter.Touched:Connect(function(part)
local char = part.Parent
local hum = char:FindFirstChild("Humanoid")
if hum then
local plr = Players:GetPlayerFromCharacter(char)
local backpack = plr:WaitForChild("Backpack")
local balls = {}
for i, v in pairs(backpack:GetChildren()) do
if v.Name == "Dodgeball" then
table.insert(balls,v)
print(#balls)
end
end
if #balls >= 3 then
ball.Parent = game.Workspace
end
end
end)
How do I fix this?