Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

I was trying to make an admin commands script but i " ')' expeted (to close '(' at line 21) near 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

7 comments

0

lol

0

forgot to mention the line 21 is the fifth one

0

error is a function, not a value

0

whole script plz :>

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.

0

Works! BUT now i have problem with line 8 :( "Expected end to close function"

1 answer

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!

2 comments

0

nope, it didnt work so here's the full script https://pastebin.com/LhN6dSzM

0

Is this even your script or are you trying to get people to fix a broken FM?

This discussion is preserved as it was. New answers, comments, and votes are closed.