Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Using a function in the module that matches string.sub()?

Asked by 9 years ago

Alright, so I am making a specific script that requires the player's input. It uses a module script to store data. I need my script to check if the module script has the data the player defined and if it does, run it. Is this possible? My current code is below.

local r = require(script.Parent.Database)
game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
        if string.lower(msg:sub(1, string.len("access "))) == "access " then
            r.msg:sub(string.len("access "))()
        end
    end)
end)

Answer this question