Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make the other part of the script execute after these if statements?

Asked by 4 years ago

Heres my code:

01for _, structureButton in pairs(StructureFrame:GetChildren()) do
02    if structureButton:IsA("TextButton") then
03        structureButton.MouseButton1Up:Connect(function()
04 
05            if structureButton.Name == "WoodWall" then
06                if game.Players.LocalPlayer.Materials.Wood.Value >= 5 then
07                    game.Players.LocalPlayer.Materials.Wood.Value = game.Players.LocalPlayer.Materials.Wood.Value - 5
08                else
09                    script.Parent.NotEnoughMats.Visible = true
10                    wait(3)
11                    script.Parent.NotEnoughMats.Visible = false
12                    return
13                end
14            else
15                if game.Players.LocalPlayer.Materials.Stone.Value >= 5 then
View all 27 lines...

(Read the -- part of the code)

1 answer

Log in to vote
0
Answered by 4 years ago

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

0
Does the same thing. Nothing happened when i removed the return Recrucity 13 — 4y
0
Try putting print statements at places in your code to see where the code stops to better understand the situation and issue iamtryingtofindname 22 — 4y
Ad

Answer this question