robloxapp-20200801-0141035.wmv (286.6 KB)
-
What do you want to achieve? I want to keep track of number of frames with green background just like in the video above. All square frames are stored inside one frame called StorageHolderFrame. Shield gui dragging works by using UserInputService.InputChanged event and holding left mouse button. When a shield collides with square frames, their color changes to green, when not, it’s white.
-
What is the issue? I just don’t know how to solve it.
-
What solutions have you tried so far? I tried using table/loop to store green frames just like in script below but the result was always wrong.
The script below is located inside UserInputService.InputChanged event. StorageHolderFrame is a frame where all square frame slots are.
for i,v in pairs(script.Parent.StorageHolderFrame:GetChildren()) do
if v.BackgroundColor3 == Color3.fromRGB(0,255,0) then
count = count + 1
end
end
print(count)
But the problem is that everytime a Shield gui position changes by even 1 pixel, the count variable increases by 1. So after like 1 second of dragging, count value is over 100. I want to track exact amount of green slots.
I’m not giving code of how it all works so I’m not expecting code with complete solution. I just want a tips how to achieve it.