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

) expected (to close ( at line 21) near <eof>?

Asked by 5 years ago

I was trying to make an admin commands script but i " ')' expeted (to close '(' at line 21) near <eof> a bit of the script:

    --//Checks if the player is banned or not
    if Player.PlayerValues.IsBanned.Value == true then
        Player:Kick("You're Banned From This Game.") --//Reason for kick
    end
end)
    Player.Chatted:connect(function(message)
        for i, AdminName in ipairs(Admins) do
            if Player.Name == AdminName then
                --//Commands\\--
                --//Kill Command
                if message:sub(1, 6) == "/kill " then
                    local TargetPlayer = game.Players:FindFirstChild(message:sub(7))
                    if TargetPlayer then
                        local Character = TargetPlayer.Character
                        if Character then
                            Character.Humanoid.Health = 0
                        end
                    end
                end

i also tryed to add

 repeat wait() until error == nil

near the error but osent work

0
lol User#19524 175 — 5y
0
forgot to mention the line 21 is the fifth one RedLecko434 -1 — 5y
0
error is a function, not a value theking48989987 2147 — 5y
0
whole script plz :> TheeDeathCaster 2368 — 5y
View all comments (3 more)
0
If you indented properly, you'd spot easily that there are two extra 'end's after --//im cencoring this command xdd, that don't match anything, and then the second-to-last 'end' in the script is missing the ) to close the Player.Chatted anonymous function. EmilyBendsSpace 1025 — 5y
0
Works! BUT now i have problem with line 8 :( "Expected end to close function" RedLecko434 -1 — 5y

1 answer

Log in to vote
0
Answered by
Oficcer_F 207 Moderation Voter
5 years ago

Your problem is that the end) is not a part of an event. You maybe thought that player:Kick() is a event, but it is a function (I believe), that makes you don't need to have an end)

So this is the fixed script,



--//Checks if the player is banned or not if Player.PlayerValues.IsBanned.Value == true then Player:Kick("You're Banned From This Game.") --//Reason for kick end Player.Chatted:connect(function(message) for i, AdminName in ipairs(Admins) do if Player.Name == AdminName then --//Commands\\-- --//Kill Command if message:sub(1, 6) == "/kill " then local TargetPlayer = game.Players:FindFirstChild(message:sub(7)) if TargetPlayer then local Character = TargetPlayer.Character if Character then Character.Humanoid.Health = 0 end end end

BTW

repeat 
wait() 
until error = nil 

Cannot be used, you an error is not a value... Anyways,

GOOD LUCK!

IF THIS HELPED, PLEASE DONT FORGET TO ACCEPT THE ANSWER!

0
nope, it didnt work so here's the full script https://pastebin.com/LhN6dSzM RedLecko434 -1 — 5y
0
Is this even your script or are you trying to get people to fix a broken FM? kieranhendy 28 — 5y
Ad

Answer this question