I'm trying to make a script that detects if a player is under 13 or not, and it involves RemoteFunctions
. Here is my LocalScript
that is located inside a TextLabel
:
local under13 = game.ReplicatedStorage:WaitForChild("GetUnder13"):InvokeServer(game.Players.LocalPlayer) if under13 then script.Parent.Text = "<13" else script.Parent.Text = "13+" end
And here is my Script
that is located in ServerScriptService
:
function GetUnder13(player) return (game:GetService("Chat"):FilterStringAsync("suck", player)):match("#") and true or false end game.ReplicatedStorage.GetUnder13.OnServerInvoke = GetUnder13
Here was the output when I ran the game:
15:26:59.312 - Baseplate auto-recovery file was created 15:27:01.350 - Unable to open plugin file (bad file format): 15:27:01.351 - Plugin_659505827 15:27:02.122 - Unable to open plugin file (bad file format): 15:27:02.123 - Plugin_659505827 15:27:05.248 - Argument 3 missing or nil <-- This is the error 15:27:05.249 - Stack Begin 15:27:05.249 - Script 'ServerScriptService.GetUnder13ForLocalScripts', Line 1 15:27:05.251 - Stack End 15:27:05.500 - Argument 3 missing or nil <-- This is the error 15:27:05.501 - Stack Begin 15:27:05.501 - Script 'Players.Owengren.PlayerGui.Home Menu.Gui.Frame.Age.ReplaceLabel', Line 1 15:27:05.502 - Stack End 15:27:09.611 - Disconnect from 127.0.0.1|61988
How is this happening? I have an argument, but I'm not sure about Argument 3!
I found out that FilterStringAsync()
requires a third value which is needed! In order, the values are stringToFilter = "suck"
, playerFrom = player
and playerTo = nil
. All I had to do is do this:
FilterStringAsync("suck", player, player)