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

when certain player says certain thing then it does script?

so im making an game with admin cmds. what i want it to do is, when you type :example / :example me. but i dont know how to make it when a certain player chatted that it then goes on to do the Script. I would like some help with this? (i cant provide scripts since i dont know where to start lol)

1 comment

0

what i mean with that is i dont have a script

1 answer

Hello, it seems you need a .Chatted function.

First, let's find the Player.

Players = game:GetService('Players')

Players.PlayerAdded:Connect(function(Player) -- Player is automatically an argument.

end)

Now that we've defined the Player, we now need to make sure to find out when the Player has Chatted, then also determined what you want them to say to activate a function.

Player.Chatted:Connect(function(Message)
	if Message:lower() == "hello world" then
		playerChatted()
	end
end)

Now all we have to do is put it all together.

Players = game:GetService('Players')




function playerChatted() 
	print("Player has said 'hello world'")
end





Players.PlayerAdded:Connect(function(Player) -- Player is automatically an argument.
	Player.Chatted:Connect(function(Message)
		if Message:lower() == 'hello world' then -- change this to the message you want them to say
		playerChatted()
		end
	end)
end)

Now, if any player says 'hello world' in the Console (F9) you should see a print saying 'Player has said hello world'

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