I'm making a shop GUI so players can buy swords and weapons. But an error appeared on the output saying "attempt to index number with 'MouseButton1Click'". and I tried everything that I could think of to fix this and it still doesn't work. I've tried finding online solutions but nothing helped. So I came here. Here's where I got the error:
box.MouseButton1Click:Connect(function()--Where I got the error
for _, v in pairs(itemViewport:GetChildren()) do
if not v:IsA("Frame") then
v:Destroy()
end
end
end)

1 comment
you just need to make local variables