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

Expected 'end' (to close 'then' at line 16), got <eof>?

Asked by 8 years ago
Edited 8 years ago

Where would the ends go to make the error go away? Won't extra ends break the script?

01for i,c in pairs(script.Parent:GetChildren()) do
02    if c:IsA("ImageButton") then
03        c.MouseButton1Click:connect(function()
04            local p = script.Parent.Parent.Parent.Parent.Parent
05            local GPS = game:GetService("MarketplaceService")
06 
07if GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Fusion.Value) then
08for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
09    if v:IsA("HopperBin") or v:IsA("Tool") then
10        if p:FindFirstChild'Backpack' then
11            v:clone().Parent = p.Backpack
12        end
13    end
14end
15 
View all 23 lines...

2 answers

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

No, notice how you opened an if statement, then an i,v in pairs, then an if, then an if, you need 4 ends to close all of them so you should do this:

01for i,c in pairs(script.Parent:GetChildren()) do
02    if c:IsA("ImageButton") then
03        c.MouseButton1Click:connect(function()
04            local p = script.Parent.Parent.Parent.Parent.Parent
05            local GPS = game:GetService("MarketplaceService")
06 
07if GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Fusion.Value) then
08for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
09    if v:IsA("HopperBin") or v:IsA("Tool") then
10        if p:FindFirstChild'Backpack' then
11            v:clone().Parent = p.Backpack
12        end
13    end
14end
15 
View all 25 lines...

hope It helped ;)

1
With that it says "Expected 'end' (to close 'then' at line 7), got <eof>.. LuckyAura -1 — 8y
0
Look again pls, just add another end to close that one ;) LisaF854 93 — 8y
1
And "Expected 'end' (to close 'function' at line 3), got <eof>.. LuckyAura -1 — 8y
0
Then add another end ;) LisaF854 93 — 8y
0
Also this script is a mess, try indexing your script correctly please. LisaF854 93 — 8y
Ad
Log in to vote
0
Answered by
arshad145 392 Moderation Voter
7 years ago

Messy scripts are unefficient for the scripter himself.

01for i,c in pairs(script.Parent:GetChildren()) do
02    if c:IsA("ImageButton") then
03        c.MouseButton1Click:connect(function()
04        local p = script.Parent.Parent.Parent.Parent.Parent
05            local GPS = game:GetService("MarketplaceService")
06        if GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) or
07            GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) or GPS:PlayerOwnsAsset(p,script.Parent.Fusion.Value) then
08               end
09    end
10end
11 
12for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
13    if v:IsA("HopperBin") or v:IsA("Tool") then
14        if p:FindFirstChild'Backpack' then
15            v:clone().Parent = p.Backpack
View all 29 lines...

Should work now. Post results , if it does not .

0
I had the same exact problem, it works fine now thanks. I had to add more ends because my script was pretty big. Thank you again! :D gego120 2 — 4y

Answer this question