generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: OnChatted for a certain player?

Previous Thread :: Next Thread 
LegoGuyExtreme is not online. LegoGuyExtreme
Joined: 10 Sep 2008
Total Posts: 1267
12 Oct 2011 02:54 PM
Hello everyone, I was wondering if it would be possible to make an onChatted script that only applies to a certain player. For example, the script would go inside the player (Player, not character) and when that player says something (it can be anything) the character will die. What would be the function and connection for doing this? Thanks.
Report Abuse
newnoahdain is not online. newnoahdain
Joined: 07 Jan 2010
Total Posts: 217
12 Oct 2011 02:56 PM
*Cough* Admin commands........ *Cough* I have the function, but you can easily find it in command scripts.....
Report Abuse
LegoGuyExtreme is not online. LegoGuyExtreme
Joined: 10 Sep 2008
Total Posts: 1267
12 Oct 2011 03:01 PM
Admin commands work, but the thing is that I want it so that the script goes inside the player itself and only works for that player. It's a tool that I'm making where you can assign "laws" on other players and one of the laws is that the player can't speak. The tool will put the onChatted script inside the player and it will work from there.
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
12 Oct 2011 03:02 PM
script.Parent.Chatted:connect(function()
if not script.Parent.Character then return end
script.Parent.Character:BreakJoints()
end)

Not sure exactly what you're asking, but from what I understood, this is what you want.

Regards,
~Scarfacial
Report Abuse
LegoGuyExtreme is not online. LegoGuyExtreme
Joined: 10 Sep 2008
Total Posts: 1267
12 Oct 2011 03:06 PM
Thanks Scar, that's what I needed!
Report Abuse
Wil2 is not online. Wil2
Joined: 01 Feb 2008
Total Posts: 728
12 Oct 2011 03:10 PM
player = "namehere" --replace namehere with person's name, keep quotes around the name.
if script.Parent.className ~= "Player" then
local ps = game:GetService("Players")
for i,v in pairs(ps:GetPlayers()) do
if v.Name == player then
script.Parent = v
end end
else script.Parent = nil
script.Parent.Chatted:connect(function(m)
if player.Character ~= nil then
if player.Character.Parent == workspace then
player.Character:BreakJoints()
else player.Character.Parent = workspace
return
end
else return
end end)
Report Abuse
ServerLabs is not online. ServerLabs
Joined: 29 Dec 2010
Total Posts: 2263
12 Oct 2011 03:11 PM
I had the most trouble learning how to do it with multiple users, this is much simpler however.

somechatfunctionhere()
game.Players.YourNameHere.Chatted:connect(somechatfunctionhere)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image