Where would the ends go to make the error go away? Won't extra ends break the script?
for i,c in pairs(script.Parent:GetChildren()) do
if c:IsA("ImageButton") then
c.MouseButton1Click:connect(function()
local p = script.Parent.Parent.Parent.Parent.Parent
local GPS = game:GetService("MarketplaceService")
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
for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
if v:IsA("HopperBin") or v:IsA("Tool") then
if p:FindFirstChild'Backpack' then
v:clone().Parent = p.Backpack
end
end
end
if GPS:PlayerOwnsAsset(p, script.Parent.Rex.Value) and GPS:PlayerOwnsAsset(p, script.Parent.Sat.Value) then
for _,v in pairs(game.ReplicatedStorage.Game_Tools[suit.Tools.Value]:GetChildren()) do
if v:IsA("HopperBin") or v:IsA("Tool") then
if p:FindFirstChild'Backpack' then
v:clone().Parent = p.Backpack
end
end
end <-- error from here

5 comments
With that it says "Expected 'end' (to close 'then' at line 7), got ..
Look again pls, just add another end to close that one ;)
And "Expected 'end' (to close 'function' at line 3), got ..
Then add another end ;)
Also this script is a mess, try indexing your script correctly please.