Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why is the string.sub command not working?

Asked by 5 days ago

I am making chat commands in my game. I am able to make chat commands with one sub. Like ";kill all". It has only 1 sub which is "all", but I don't know how to make it two sub like ";cashvalue player1 100".

I have made the following script up till now. Please tell me how I can make it work. It doesn't print any thing in the output:

elseif string.sub(msg, 1, 14) == "/e ;cashvalue " then
        local target = string.lower(string.sub(msg, 15))
        local plrs = game.Players:GetPlayers()
        for i,v in pairs(plrs) do
            local tName = string.lower(v.Name)
            if string.sub(tName, 1, target:len()) == target then
                local amount = string.sub(msg, target:len() + 15)
                print("done")
        end
    end
end

Thanks!

0
You're on the right track, have you printed the result of `amount`? Goulstem 7955 — 5d
0
It doesn't print any thing. StrategicPlayZ 50 — 5d

Answer this question