local function touched(v) print("a") v.Touched:Connect(function(t) print(t.Name) if(t.Name == "OpenBox")then local box = game.ReplicatedStorage.Items.Box:Clone() box.CFrame = t.CFrame t:Destroy() box.Parent = workspace end end) end local function spawnitems(spawner) while wait(10) do local folder = {game.ReplicatedStorage.Items.OpenBox, game.ReplicatedStorage.Items.Envelope} local part = folder[math.random(1,#folder)]:Clone() part.Parent = workspace part.CFrame = spawner.CFrame part.Velocity = Vector3.new(0,0,-20) end end for i,v in pairs(workspace:GetDescendants())do if(v.Name == "Conveyor")then v.Velocity = v.CFrame.LookVector * 20 end if(v.Name == "Tape")then print("KJASDKJSADKJasjkd") touched(v) end if(v.Name == "Spawner")then spawnitems(v) end end
it can detect everything else but not tapem even if the string exactly matches with the name
simple mistake, use elseif
instead of just if
. so,
for i,v in pairs(workspace:GetDescendants())do if(v.Name == "Conveyor")then v.Velocity = v.CFrame.LookVector * 20 elseif(v.Name == "Tape")then print("KJASDKJSADKJasjkd") elseif(v.Name == "Spawner")then print("bruh") end end