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

How can I match a string with an existing player?

Asked by 7 years ago
Edited 7 years ago

I tried this:

local plrs = game.Players:GetPlayers

function findPlayer(message,speaker)
    if (string.sub(message,1,5) == "kill/" and (string.sub(message,7) == plrs.Name then
        print("kaboom.")
end

This script is trying to match a chat message with an object, but this won't work.

0
Line1: ':GetPlayers' should be ':GetPlayers()" it is a function, don't forget the parentheses. UniversalDreams 205 — 7y
0
If you're trying to find who said that then you should use Chatted. StoIid 364 — 7y
0
game.Players:FindFirstChld(message:sub(7,-1)) User#6546 35 — 7y
0
You seem to not understand how tables work, or the function GetChildren/GetPlayers. User#11440 120 — 7y

Answer this question