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)

2 comments
Does the same thing. Nothing happened when i removed the return
Try putting print statements at places in your code to see where the code stops to better understand the situation and issue