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

How can I do Voice Commands? [closed]

Asked by 10 years ago

How can I make a script where I can chat a command, like in admin commands, and the command does a kind of function, like when in Person299's admin commands when you say 'kill/plr' and it kills a player, how can I make a script like that?

Locked by TheeDeathCaster

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

Why was this question closed?

2 answers

Log in to vote
1
Answered by 10 years ago
game.Players.PlayerAdded:connect(function(plr)
-- if admin
if plr.Name == "p00pser" then
plr.chatted:connect(function(msg)
if msg:lower():sub(1,--[[how long it is]]5) == "derp/" then
local plr = game.Players:findFirstChild(msg:lower():sub(6--[[how long it is+1]]))
plr.Character.Humanoid.Health = 0
end
end)
end
end)

and yes I just made this script here

0
Thanks guys, I apprieciate it! ;) TheeDeathCaster 2368 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

You will need to use the PlayerAddedevent. The Chattedevent. After you get the message you will have to use string manipulation to dissect the message.

Game.Players.PlayerAdded:connect(function(Player)
    --Check for specific names here if wanted.
    Player.Chatted:connect(function(msg)
        if msg == "bob" then
            --------------
        end
    end)
end)
0
Thanks man! TheeDeathCaster 2368 — 10y