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 » Scripters
Home Search
 

It only doesn't set for the first string but not the next 3

Previous Thread :: Next Thread 
Codathryl is not online. Codathryl
Joined: 12 Jan 2011
Total Posts: 474
06 Nov 2016 01:21 AM
banwords = {"%p####################?########################?######################?##################player = game.Players.LocalPlayer
warns = player.Warns
script.Parent.TextButton.MouseButton1Click:connect(function()
local ToBeText = script.Parent.TextBox.Text
local TextNow = game.Workspace[game.Players.LocalPlayer.Name].Sign.Text.SurfaceGui.TextLabel.Text
for i=1,#banwords do
if string.lower(ToBeText):match(banwords[i]) then
print(player.Name.." attempted to swear on a sign.")
warns.Value = warns.Value + 1
return
elseif not string.lower(ToBeText):match(banwords[i]) then
game.Workspace[game.Players.LocalPlayer.Name].Sign.Text.SurfaceGui.TextLabel.Text = script.Parent.TextBox.Text
##################### basically it's a custom filter (I know, TOS violation) but it's just a test. The text on the sign stays the same like it's supposed to for the first string in the table, but it doesn't do that for the next 3. It sets it to the user input which is a swear word. How do I fix this?


Current RAP: 10,538 ROBUX: R$258 - Send Offers
Report Abuse
enzotinman1 is not online. enzotinman1
Joined: 22 Jun 2012
Total Posts: 408
06 Nov 2016 01:26 AM
the
for i=1,#banwords do

i think needs to be
for i=0,#banwords do

as the first data in a table is 0 not 1
Report Abuse
Codathryl is not online. Codathryl
Joined: 12 Jan 2011
Total Posts: 474
06 Nov 2016 01:29 AM
ah, i'm an idiot. works now thanks


Current RAP: 10,538 ROBUX: R$258 - Send Offers
Report Abuse
enzotinman1 is not online. enzotinman1
Joined: 22 Jun 2012
Total Posts: 408
06 Nov 2016 01:29 AM
:P np
Report Abuse
Codathryl is not online. Codathryl
Joined: 12 Jan 2011
Total Posts: 474
06 Nov 2016 01:30 AM
wait, now it says this:


01:30:03.235 - Players.Player1.PlayerGui.ChangeText.TextChange.LocalScript:9: bad argument #1 to 'match' (string expected, got nil)
01:30:03.236 - Stack Begin
01:30:03.236 - Script 'Players.Player1.PlayerGui.ChangeText.TextChange.LocalScript', Line 9
01:30:03.236 - Stack End


Current RAP: 10,538 ROBUX: R$258 - Send Offers
Report Abuse
enzotinman1 is not online. enzotinman1
Joined: 22 Jun 2012
Total Posts: 408
06 Nov 2016 01:33 AM
is Players.Player1.PlayerGui.ChangeText.TextChange.LocalScript the script you pasted above and is line 9 print(player.Name.." attempted to swear on a sign.")
Report Abuse
Codathryl is not online. Codathryl
Joined: 12 Jan 2011
Total Posts: 474
06 Nov 2016 01:34 AM
line 9 is

if not string.lower(ToBeText):match(banwords[i]) then


Current RAP: 10,538 ROBUX: R$258 - Send Offers
Report Abuse
enzotinman1 is not online. enzotinman1
Joined: 22 Jun 2012
Total Posts: 408
06 Nov 2016 01:44 AM
what writing is in script.Parent.TextBox.Text ?
Report Abuse
Codathryl is not online. Codathryl
Joined: 12 Jan 2011
Total Posts: 474
06 Nov 2016 01:45 AM
user input


Current RAP: 10,538 ROBUX: R$258 - Send Offers
Report Abuse
enzotinman1 is not online. enzotinman1
Joined: 22 Jun 2012
Total Posts: 408
06 Nov 2016 01:48 AM
im guessing there was nothing in it when the script ran?
maybe try putting this before the for loop:
if ToBeText == nil then
ToBeText = ""
end
Report Abuse
OzzyFin is not online. OzzyFin
Joined: 07 Jun 2011
Total Posts: 3600
06 Nov 2016 02:11 AM
"as the first data in a table is 0 not 1"

not in lua
Report Abuse
enzotinman1 is not online. enzotinman1
Joined: 22 Jun 2012
Total Posts: 408
06 Nov 2016 03:57 AM
oh my bad :/
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