So what i want my code to do is when i chat ';level bub 100' it changes my level to 100. However im having troubles getting the values from the string when the player chats.
--Prefix being ';'
if msg:lower():sub(1,#Prefix + 6) == Prefix:lower() .. "level " then
print("Level Command")
--Check if a player with the name following (or part of the name) exists
local levels = msg:lower():sub(7):find(" ") + 6
local name = msg:lower():sub(#Prefix + (levels - 1) )
print("levels ".. levels) --Prints 7(?)
print("name ".. name) -- Prints ''bub 100'
for i,v in pairs(game.Players:GetChildren()) do
if v.Name:sub(1, #name):lower() == name then
v.leaderstats.Lvl.Value = Levels
end
end
end
Ive been playing around a while with this; but fairly new to this area. Any helps is much appreicated; Thanks, Bubs.
