I saw a couple of games on roblox about the whole oh you cant say this word or you have this number of words and thought it'll be a fun challenge to set myself to make a small game which gives you a set amount of words and if you use up all of them you get banned from the game.
Now everything works as intended, the value, the subtraction when you say something, the correct amount of words, the kick when you run out of words
But I have run into an issue, I have a overhead gui over the player that displays the number of words you can utilize until you are banned from the game. I have a line of code in the player.Chatted event where it updates the text but it doesn't actually happen and it just stays the same as the number you first start out with.
Here is the code if anyone would like to help, thank you in advance.
local wordsGui = game:GetService("ServerStorage"):WaitForChild("Overhead"):WaitForChild("wordsLeft")
game.Players.PlayerAdded:Connect(function(player)
local hasWords = true
local rollWords = math.random(1, 100)
local wordsLeft = Instance.new("IntValue", player)
wordsLeft.Name = "wordsLeft"
wordsLeft.Value = rollWords
wordsGui.Text = ("Words left: "..wordsLeft.Value)
player.Chatted:Connect(function(msg)
local message = msg
local amount = #string.split(message, " ")
print(amount)
wordsLeft.Value -= amount
wordsGui.Text = ("Words left: "..wordsLeft.Value)
if wordsLeft.Value <= 0 then
local kickQuotes = {" L bozo", " L + ratio", " because you are stupid", ", you could've chosen literally anything better to say", " get good kid"}
local randomKickQuote = math.random(1, 5)
player:Kick("Out of words"..kickQuotes[randomKickQuote])
end
end)
end)

2 comments
That text might get you banned, knowing roblox moderation.
ong lol