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

Kill command still not working even with previously told methods, can anyone help?

Asked by
chafava -113
5 years ago
Edited 5 years ago

I tried using ABritishChaps string:sub idea, but it did not work and the SH Discord said string.find is better, can anyone help?

        if string.find(prefix, "kill ") then
              print("found that")
           target = game.Players:FindFirstChild(msg:sub(7))
              print(target)



    end

ps. Already put player.chatted and stuff! I will do the kill function later but for now the script just lets me know if it is working!

0
I'm not sure but after "prefix", try using ".. 'kill '" instead of a comma. I have a function on my other device. I will try to help you whenever I am able. KDarren12 705 — 5y
0
ok, will try kdarren! chafava -113 — 5y
0
I tried but it still will not work! chafava -113 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Using string.sub

string string.sub ( string s, int i = 1, int j = -1 )

if string.sub(msg, 1, 6) == prefix .. "kill " then -- If the command starts with the prefix
    local target = string.sub(msg, 7) -- Use string.sub to substring the prefix and command from the "target"
    print(target) -- print the target
end

oh yeah u should work on ur whitespacing i dont know how could SH be so bad at scripting lmao

Ad

Answer this question