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

Why does my script print out 'Error occurred, no output from Lua.'?

I have a ChatFilter script that kicks players whenever they say a certain word in the blacklist. Although, this is not the case. Whenever a player joins the game, before they even speak, this error is printed to the output: 'Error occurred, no output from Lua'.

I am not sure what this means, as I have never heard of or even experienced this before. The error occurs on line 7.

local Players = game:GetService("Players")

local blacklist = {
    "the code is", "code", "alpha";
}

Players.PlayerChatted:Connect(function(messageType, player, message)
    for _, blocked in next, blacklist do
        if string.match(message, blocked) then
           player:Kick("[ChatFilter] You have said a word or phrase that has caused you to be kicked. You may rejoin.")
			print("[Kick]"..player.Name.." has been kicked by [ChatFilter].")
        end
    end
end)

1 comment

0

If you are playing it on voidacity's script builder Or another script builder, Sometimes it dont allows you to Do lua scripts, I don't know what to say, just saying this.

1 answer

✓ Accepted answer

.PlayerChatted isn't a method of Players Service.

Note: This is a method, but this can't be used in scripts, only in the command bar

Use .Chatted of players.

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		
	end)
end)

As for the blacklist, you pretty much have it right. I'd just use find, though, tbh.

local blacklist = {
	"the code is";
	"code";
	"alpha";
}

local function isMsgAllowed(msg) -- functions make things nice (break code into chunks)
	msg = msg:lower() -- make it lowercase
	for _,blocked in next, blacklist do
		if(msg:find(blocked))then
			return false
		end
	end
	return true
end

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if(not isMsgAllowed(msg))then
			plr:Kick("MSG")
		end
	end)
end)

3 comments

0

I forgot about that. Aha. Thanks.

0

Isn't a method. |Sentence Afterwards| It's a method.

0

@CootKitty, may I suggest an improvement? Perhaps you could make it check if it was a letter or two off aswell, that way players couldn't substitute in symbols or the like and bypass the filter.

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