I just spent the last 20 minutes typing up this script for you. Hope it works:
A ServerScript (can go in serverscriptservice or workspace)
local remote = Instance.new('RemoteEvent', game.ReplicatedStorage)
remote.Name = "ShowChatLevelMsg"
function showMsg(msg) -- this is the function to show a message to everyone
remote:FireAllClients({
Text = msg;
Color = BrickColor.new("Beige").Color;
Font = Enum.Font.SourceSans;
FontSize = Enum.FontSize.Size18;
})
end
local lvl_up = 7
local leaderstats = true -- Set this to false to disable leaderstats!
game.Players.PlayerAdded:Connect(function(player)
showMsg(player.Name .. " has joined! Talk to level up!")
local chats = 0
local player_lvl = 0
local lvl = Instance.new('IntValue')
lvl.Name = "ChatLevel"
if lvl_up <= 3 then
wait(5) return showMsg('The chat system\'s level up feature is too low, it wont work!'), showMsg('Reverting ..'), script:Destroy() -- stops the whole script (i hope)
end
if leaderstats then
local leaderstats = Instance.new('Folder', player)
leaderstats.Name = "leaderstats"
lvl.Parent = leaderstats
end
player.Chatted:Connect(function(msg)
if not string.find(msg, ".") then -- this is the function to fix sentences
chats = chats + 1
elseif string.find(msg, ".%a") then
local a, times = string.find(msg, ".%a")
chats = chats + times
end
if chats >= lvl_up then
chats = 0
player_lvl += 1
wait(0.25)
print('Player '.. player.Name .. ' has leveled up to level '.. player_lvl ..'!')
showMsg('Player '.. player.Name .. ' has leveled up to level '.. player_lvl ..'!')
lvl.Value = player_lvl
end
end)
end)
It should find sentences and add more points depending on the amount of sentences, but it also gives you a point even if you dont use a .
EDIT: Just made an update and fixed it so it doesn’t automatically revert!
- Added leaderstats so it can be easily accessed, maybe for shops, etc. - Added a limit to how low the sentence count can go and if too low will remove everything.
It’s not perfect, but it still works. Tell me if there are any problems
but, will a normal data store fix it from restarting your levels when you join the game again? Or there need to be a whole data store for the level system