Where would the ends go to make the error go away? Won't extra ends break the script?
01 | for i,c in pairs (script.Parent:GetChildren()) do |
02 | if c:IsA( "ImageButton" ) then |
03 | c.MouseButton 1 Click:connect( function () |
04 | local p = script.Parent.Parent.Parent.Parent.Parent |
05 | local GPS = game:GetService( "MarketplaceService" ) |
06 |
07 | if GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Fusion.Value) then |
08 | for _,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 |
14 | end |
15 |
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:
01 | for i,c in pairs (script.Parent:GetChildren()) do |
02 | if c:IsA( "ImageButton" ) then |
03 | c.MouseButton 1 Click:connect( function () |
04 | local p = script.Parent.Parent.Parent.Parent.Parent |
05 | local GPS = game:GetService( "MarketplaceService" ) |
06 |
07 | if GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) or GPS:PlayerOwnsAsset(p, script.Parent.Fusion.Value) then |
08 | for _,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 |
14 | end |
15 |
hope It helped ;)
Messy scripts are unefficient for the scripter himself.
01 | for i,c in pairs (script.Parent:GetChildren()) do |
02 | if c:IsA( "ImageButton" ) then |
03 | c.MouseButton 1 Click: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 |
10 | end |
11 |
12 | for _,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 |
Should work now. Post results , if it does not .