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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What am I doing wrong with this chat server script?

Previous Thread :: Next Thread 
DesiredROBLOXlAN is not online. DesiredROBLOXlAN
Joined: 01 Mar 2012
Total Posts: 971
23 Mar 2017 04:05 AM
Here's the code on the server's end...

Quick note, it doesn't print anything as well!


ChatEvent = game:GetService("ReplicatedStorage").ChatEvent:WaitForChild("Chat")


ChatEvent.OnServerEvent:connect(function(player, ChatText)

for i,v in ipairs(game.Players:GetPlayers()) do
local L10 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line10
local L9 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line9
local L8 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line8
local L7 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line7
local L6 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line6
local L5 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line5
local L4 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line4
local L3 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line3
local L2 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line2
local L1 = v.PlayerGui:WaitForChild("Status"):WaitForChild("ScrollingFrame").LocalScript.Chat.Line1

local filteredText = game.Chat:FilterStringAsync(ChatText, player,v)

L10.Value = L9.Value
print(filteredText)
L9.Value = L8.Value
L8.Value = L7.Value
L7.Value = L6.Value
L6.Value = L5.Value
L5.Value = L4.Value
L4.Value = L3.Value
L3.Value = L2.Value
L2.Value = L1.Value
L1.Value = player.Name.."["..player.Stats.Level.Value.."]: "..filteredText
print(L1.Value)

end
end)


~The most desired of Robloxians
Report Abuse
CrimsonSparkleTime is not online. CrimsonSparkleTime
Joined: 25 Feb 2016
Total Posts: 2161
23 Mar 2017 04:07 AM
for i,v in ipairs(game.Players:GetPlayers()) do


R$0
Report Abuse
CrimsonSparkleTime is not online. CrimsonSparkleTime
Joined: 25 Feb 2016
Total Posts: 2161
23 Mar 2017 04:07 AM
Isn't it pairs not ipairs?


R$79,850
Report Abuse
DesiredROBLOXlAN is not online. DesiredROBLOXlAN
Joined: 01 Mar 2012
Total Posts: 971
23 Mar 2017 04:10 AM
I think there isn't a difference as far as I know. I also tried it with just pairs for good measure but it still won't do anything.


~The most desired of Robloxians
Report Abuse
Iriesoja is not online. Iriesoja
Joined: 28 Jan 2011
Total Posts: 993
23 Mar 2017 04:14 AM
ipairs stops when it finds a nil value


Report Abuse
Ben1925 is not online. Ben1925
Joined: 07 Apr 2011
Total Posts: 741
23 Mar 2017 04:16 AM
pairs() allows iteration over key-value pairs.
ipairs() allows iteration over index-value pairs, where the key is a number.

Use ipairs() when you want to return a table with numeric keys in proper order.

Don't use ipairs() on tables with keys that are not integers. It won't work.
Report Abuse
DesiredROBLOXlAN is not online. DesiredROBLOXlAN
Joined: 01 Mar 2012
Total Posts: 971
23 Mar 2017 04:18 AM
Oh okay that makes sense, thankyou.


~The most desired of Robloxians
Report Abuse
DesiredROBLOXlAN is not online. DesiredROBLOXlAN
Joined: 01 Mar 2012
Total Posts: 971
23 Mar 2017 04:25 AM
Well I fixed the problem. Thanks for the help with ipairs and pairs though!


~The most desired of Robloxians
Report Abuse
Ben1925 is not online. Ben1925
Joined: 07 Apr 2011
Total Posts: 741
23 Mar 2017 04:27 AM
Not a problem mate. :D
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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