You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I am making A script that kicks people when they say"bad words"n o practice scrtipting.
-
What is the issue? I keep getting an error in the output which changes depending on what I do with the code.
-
What solutions have you tried so far? I have tried removing local from the variables and removing the equals sign depending on which error is being displayed.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that itâs easier for people to help you!
This script would be found in game.workspace.antiBadWordScript
local warning = 0
function onPlayerChatted(player, message)
if message == "noob" then
local warning = local warning + 1
end
if
local warning 1> then
player:kick("Hi!")
end
function onPlayerEntered(player)
wait(1)
player.Chatted:connect(function (message) onPlayerChatted(player, message) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
The script does not work but does if you remove the warning variable and kick instantly it does.
The output error is:
22:01:56.055 - Workspace.Anti Bad Word Script:4: Expected identifier when parsing expression, got âlocalâ]
if I remove local the error changes to:
22:05:06.116 - Workspace.Anti Bad Word Script:7: Expected identifier when parsing expression, got âlocalâ
if I remove that:
22:05:36.313 - Workspace.Anti Bad Word Script:7: Expected âthenâ when parsing if statement, got â1â