|
| 18 Aug 2012 12:58 PM |
locals = game.Players:GetChildren() equip = false
function chat(msg) if equip ~= false then for i=1,#locals do if locals[i].Backpack:FindFirstChild("Radio") ~= nil then instance.new("Hint", locals[i].PlayerGui).Text = msg wait(1) locals[i].PlayerGui.Message:Destroy() end end end end
script.Parent.Equipped:connect(function () equip = true end)
script.Parent.Unequipped:connect(function () equip = false end)
script.Parent.Parent.Parent.Chatted:connect(chat)
The problem: It doesnt work. There's no output.
|
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 18 Aug 2012 01:04 PM |
What do you mean with debug? A reload time? |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2012 01:04 PM |
de·bug/dēˈbəg/ Verb: Identify and remove errors from (computer hardware or software).
|
|
|
| Report Abuse |
|
|
|
| 18 Aug 2012 01:13 PM |
| Is it creating the Hint inside the PlayerGui? |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2012 01:24 PM |
| I wouldn't know. You can't test the .Chatted event in test mode. |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 18 Aug 2012 01:27 PM |
Just a quick look,
"instance.new("Hint", locals[i].PlayerGui).Text = msg"
Instance should be capitalized.
|
|
|
| Report Abuse |
|
|
|
| 18 Aug 2012 01:30 PM |
| @Shobobo99 I missed that, but it still doesn't work. I cant seem to figure it out... |
|
|
| Report Abuse |
|
|
| |
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 18 Aug 2012 01:39 PM |
| Here's a problem. Your script creates the players table when the player joins, so any new players that join will not receive the message. Does the message get displayed to yourself? |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2012 01:42 PM |
| Not even to myself. I was also thinking that what you said will happen too. What do you think I should do? |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 18 Aug 2012 02:06 PM |
Oh, here we are.
"if locals[i].Backpack:FindFirstChild("Radio") ~= nil then"
You are checking the BACKPACK when what you really want is to check the CHARACTER, because when tools become equipped they parent to the character.
locals = game.Players:GetPlayers() -- this will fix your new player issue for i=1,#locals do if locals[i].Character and locals[i].Character:FindFirstChild("Radio") then -- check if character exists, then if Radio is equipped local h = Instance.new("Hint", locals[i]:FindFirstChild("PlayerGui")) h.Text = msg wait(1) h:Destroy() end end
The reason I made the hint a variable was to make sure that the hint you are removing is the one you created (in case of multiple messages).
|
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 18 Aug 2012 02:07 PM |
| So that is to go inside the Chat function. |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2012 02:17 PM |
| I want it to display to everyone else in possession of the radio, even when it's not equipped. |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2012 02:21 PM |
| Also, the changes you made didnt work. |
|
|
| Report Abuse |
|
|
| |
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 18 Aug 2012 03:34 PM |
You can test that event.
Typ in command bar. game.Players.Player:SetSuperSafeChat(false) |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2012 03:51 PM |
All I'm getting is this: 15:49:17 - attempt to call a nil value 15:49:17 - Disconnected event because of exception |
|
|
| Report Abuse |
|
|
| |
|