so i have a fully working script for now which infinitely spawns cubes with randomisation, but thats not the issue, the issue is i want to make the cubes collectable when you walk into them. but so far nothing i've tried worked.
here is what i have right now for it:
newCube.Touched:Connect(function(touched)
local humanoid = touched.Parent:WaitForChild("Humanoid")
if humanoid then
game.Players.LocalPlayer.leaderstats.money = game.Players.LocalPlayer.leaderstats.money + value
end
end)```
the main issue in output is in the 2nd line, which when the part is touched it says 'Infinite yield possible on 'Workspace:WaitForChild("Humanoid")'
** You are now Level 2! **