Hello there, I just made this script where when the pellet is touched by a player, it increases their walkspeed, but when it touches a part that is not a player, it will stop going down so a player can catch it. Here is the code.
local touch = false
local humtouch = false
while humtouch == false do
if touch == false then
script.Parent.Position = script.Parent.Position + Vector3.new(0, -0.5, 0)
end
script.Parent.Touched:Connect(function(hit)
touch = true
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
if humtouch == false then
humtouch = true
hum.WalkSpeed = hum.WalkSpeed + 5
addbeam(tostring(hit.Parent.Name))
script.Parent.CanCollide = false
for i = 0, 1, 0.1 do
script.Parent.Transparency = i
wait(0.05)
end
script.Parent:Destroy()
end
end
end)
wait()
end
Howcome it detects only the player touching it, but not if any other part is touched? Help is appreciated.

1 comment
the code looks weird because idk how to use the new system and idk how to fix it