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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 06 Nov 2016 01:44 AM |
| what writing is in script.Parent.TextBox.Text ? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|