|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 12 Oct 2011 03:06 PM |
| Thanks Scar, that's what I needed! |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|