So for instance, i have this:
game:GetService("Players").randomplayer.Chatted:Connect(function(msg)
if msg == "range" then
end
end)
How would i check if after the range, it's a number value and what number it is?
I think it's something to do with using dots like "range" .. something i don't know though..

17 comments
don't use :connect, its deprecated, use :Connect instead
ok, but like that doesn't help me here?
if tonumber(msg) then
ok then, how do i store the value i get
local num = tonumber(msg); if num then
you could use string.sub and convert to unicode/ascii and check if it's within the range 48 to 57.
also, tonumber() does not check if it's a number, it just converts a string to a number. So if they don't say a number it will cause an error.
local playerId = "1234567890" local newPlayerId = tonumber(playerId) print(newPlayerId) >>>123456789
how would i apply that to my script, im sort of stupid
Lol, you're not stupid. I'll write something up in a minute
thank you my good sir
Tbh, unicode might be unnecessary, so i'm just checking
Alright
cant u just use
if tonumber(string) thenit'll return nil if its not a number
if i do that it says attempt to compare number with nil
if tonumber("hello") then -- false, if tonumber("1") then -- truthy