Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

end statements are having an error?

Asked by 3 months ago
local MarketPlaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(plr)
    local success, message = pcall(function()
        local haspass = false
        local gamepassID = 9794050
        haspass = MarketPlaceService:UserOwnsGamePassAsync(plr.UserId, gamepassID)
        local toolclone = game.ServerStorage.GravityCoil:Clone()
            toolclone.Parent = plr.Backpack
            game.Workspace:WaitForChild(plr.Name):WaitForChild("Humanoid").Died:Connect(function() -- They've already loaded and won't get their StarterGear until next spawn
                wait()
                local toolclone1 = game.ServerStorage.GravityCoil:Clone()
                toolclone1.Parent = plr.Backpack
                print(toolclone.Parent)
            end)
        end
    end)    
end)

so in this code at line 16 it has an error it says expected ) to close ( at line 4 got end

0
Try removing the first end statement and move the bracket to the next line. radiant_Light203 388 — 3mo

2 answers

Log in to vote
1
Answered by 3 months ago

Remove the end that doesn't have the parenthesis

Ad
Log in to vote
1
Answered by 3 months ago

ok guys i did it

local MarketPlaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(plr)
    local success, message = pcall(function()
        local haspass = false
        local gamepassId = 9794050
        haspass = MarketPlaceService:UserOwnsGamePassAsync(plr.UserId, gamepassId)
            local toolclone = game.ServerStorage.GravityCoil:Clone()
            toolclone.Parent = plr.Backpack
            while true do
                local tool = plr.Backpack:FindFirstChild("GravityCoil")  or plr.Character:FindFirstChild("GravityCoil")
                if not tool then
                    toolclone = game.ServerStorage.GravityCoil:Clone()
                    toolclone.Parent = plr.Backpack
                end
                wait()
            end
    end)    
end)

Answer this question