When I use a while loop then a for loop then mouseButton1Click, i need to click multiples times before the button even detects that I am clicking the button, its like, I am clicking a button and it is ignoring me until the right time then the functions work, is there a way I can make this instant and less buggy?
repeat wait() until game:GetService("Players").LocalPlayer
local oi = true
local f = script.Parent.InstantOpenAndClose
repeat wait() until game.Players.LocalPlayer.PlayerScripts.gettingMonsters.Done.Value == true
while wait() do
for _, v in pairs(script.Parent.Parent.Parent.ScrollingFrame:GetChildren()) do
for _, v in pairs(script.Parent.Parent.Parent.ScrollingFrame:GetChildren()) do
v.MouseButton1Down:connect(function()
f.Value = not f.Value
script.Parent["Effect_Other_Gui's"].Value = not script.Parent["Effect_Other_Gui's"].Value
if v then
if v:FindFirstChild("Health") then
end
script.Parent.Parent.ItemName.Text = v:FindFirstChild("Name_Of_Item").Value
script.Parent.Parent.Health.Text = "Health: "..v.Health.Value.." (Randomized)"
script.Parent.Parent.Sell.DestroyName.Value = v.Name
end
end)
end
end
end
Don't worry about the stuff inside of the mousebutton1click, I just need a reason why it is so buggy.. Any help would be great, I will also accept the answer and upvote it if the answer is what i needed.

1 comment
I am using the second loop as a "Render step"