The problem area is lines 16-22, where it won't find the player that I'm talking about. The command I would use would be /awarp 001 CardboardRocks to award 1 PP to CardboardRocks. Any ideas as to why this isn't working?
keyword = "/awarp"
local PointsService = Game:GetService("PointsService")
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
pointsToAward = PointsService:GetAwardablePoints()
player.Chatted:connect(function(msg)
if string.find(msg:lower(), keyword) then
print("Found "..keyword)
a = msg:sub(8, 11)
print(a)
c = msg:sub(12, msg:len())
playerschildren = game.Players:GetChildren()
for i, v in pairs(playerschildren) do
if c == v then
print("Through")
d = playerschildren[v]
print(d.Name)
else
print("Not")
end
end
if pointsToAward > 0 then
game:GetService("PointsService"):AwardPoints(d.userId, a)
end
end
end)
end)

2 comments
I believe it's supposed to be "v.Name"
Protip:
#stris the same asstr:len();sub's second parameter is optional andsubdefaults to taking remainder of string. In any case, specifying-1is the same as specifying#str!