Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I do Voice Commands?

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?

2 answers

✓ Accepted answer
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

1 comment

0

Thanks guys, I apprieciate it! ;)

You will need to use the PlayerAdded event. The Chatted event. 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)

1 comment

0

Thanks man!

This discussion is preserved as it was. New answers, comments, and votes are closed.