cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 01 Jun 2015 03:13 PM |
This script worked in Studio mode, but when I get on the game, it doesn't work... Help?
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name) msg = string.lower(msg) local pos1 = script.Parent.Position local pos2 = speaker.Character.Head.Position local dist=(pos1-pos2).magnitude dist=dist-math.max(math.max(speaker.Character.Head.Size.x, speaker.Character.Head.Size.z), speaker.Character.Head.Size.y) if (dist <= 3 and script.Parent.On.Value == true) then local h = game.Players.Player.PlayerGui.ScreenGui.TextLabel h.Visible = true h.Text = msg wait(3) h.Visible = false end
end
function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end
game.Players.ChildAdded:connect(onPlayerEntered)
|
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 01 Jun 2015 03:16 PM |
"function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end
game.Players.ChildAdded:connect(onPlayerEntered)" I'm gonna say that's where you went wrong. |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
| |
|
|
| 01 Jun 2015 03:20 PM |
| maybe change ChildAdded to PlayerAdded |
|
|
| Report Abuse |
|
|
cross700
|
  |
| Joined: 20 Oct 2012 |
| Total Posts: 258 |
|
|
| 02 Jun 2015 04:28 PM |
| I tried that already, nothing happened |
|
|
| Report Abuse |
|
|