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

Why doesn't this chat command work!?!?! [closed]

Asked by 10 years ago

I have tried so much to figure this out. It. Just. Won't. Work. Please help!

game.Players.PlayerAdded:connect(function(p) local RN = p:GetRankInGroup(1065415) if RN > 5 then p.Chatted:connect(function(msg) if msg:sub(1,4) == ":DP " then local length = 5 repeat local cmsg = msg:lower():sub(length, length) length = length + 1 until cmsg == " " space = length plr = msg:lower():sub(5, space - 1) val = msg:lower():sub(space + 1) value = tonumber(val) game.Players:FindFirstChild(plr):FindFirstChild("D-POINTS").Value = value end end) end end)

By the way, I am only on this website, for this one question. Don't expect me to be on here a lot.

Locked by TheMyrco

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
2
Answered by
TheMyrco 375 Moderation Voter
10 years ago
game.Players.PlayerAdded:connect(function(p) 
    local RN = p:GetRankInGroup(1065415) 
    if RN > 5 then 
        p.Chatted:connect(function(msg) 
            if msg:sub(1,4) == ":DP " then 
                local length = 5 
                local cmsg = ""
                local lastchar = ""
                repeat 
                    lastchar = msg:lower():sub(length, length) 
                    cmsg = cmsg .. lastchar
                    length = length + 1 
                until lastchar == " " 
                space = length 
                local plr = msg:sub(5, space - 1) 
                local val = msg:sub(space + 1) 
                local value = tonumber(val) 
                game.Players:FindFirstChild(plr):FindFirstChild("D-POINTS").Value = value 
            end 
        end) 
    end 
end)
Ad