Hello I`m using a collider for my Shop and i have a problem that if you hold clicked it is buying unlimited times. But i wanna have only one buy per Click
Heres my Script
if (hit2.collider.name == "Item2")
{
if (Infected >= item2numberprice)
{
if (item2bought <= item2max)
{
while (x == 0)
{
Infected -= item2numberprice;
item2bought = 1;
item2boughttimes += 1;
x += 1;
break;
}
}
}
}
x = 0;