Heres my code:
for _, structureButton in pairs(StructureFrame:GetChildren()) do if structureButton:IsA("TextButton") then structureButton.MouseButton1Up:Connect(function() if structureButton.Name == "WoodWall" then if game.Players.LocalPlayer.Materials.Wood.Value >= 5 then game.Players.LocalPlayer.Materials.Wood.Value = game.Players.LocalPlayer.Materials.Wood.Value - 5 else script.Parent.NotEnoughMats.Visible = true wait(3) script.Parent.NotEnoughMats.Visible = false return end else if game.Players.LocalPlayer.Materials.Stone.Value >= 5 then game.Players.LocalPlayer.Materials.Stone.Value = game.Players.LocalPlayer.Materials.Stone.Value - 5 else script.Parent.NotEnoughMats.Visible = true wait(3) script.Parent.NotEnoughMats.Visible = false return end end -- ******This doesnt execute after the if statements script.Parent.Cancel.Visible = true StructureFrame.Visible = false
(Read the -- part of the code)
Return ends the loop, so I’m guessing those return things are the problem. Try deleting them and running it again, and check your if parameters