Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need help with filtering words for my nametag?

Asked by 5 years ago

I wan't a nametag system like the game survivior but I wan't it to not allow you to use "[]" in the name?

what I have atm.

local RepStorage = game:GetService("ReplicatedStorage")
local Remote = RepStorage:WaitForChild("NametagCreatingEvent")

script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.Parent.NameColor ~= "Nothing" and script.Parent.Parent.EnterNameBox.Text ~= "Enter name here" then 
        local NameChoice = script.Parent.Parent.EnterNameBox.Text
        if string.find(NameChoice, "[]") then
            script.Parent.Parent.EnterNameBox.Text = "Please don't try to imitate Moderation"
        else
            --Varibles--
            local PlayerName = game.Players.LocalPlayer.Name
            local ColorChoice = script.Parent.Parent.NameColor.Value
            --RemoteEvents--
            Remote:FireServer(NameChoice, ColorChoice)
            --Tweens
            wait(0.2)
            script.Parent.Parent.Parent.Backround:TweenPosition(UDim2.new(0.5,-200,1,0),"In","Quad",0.5,true)
        end
    end
end)
0
Show your server code. popeeyy 493 — 5y
0
the problem with that script is it looks for [] directly, e.g. "Hello []", and not words wrapped in square brackets. You can use [%s] or [%u]. %s is a string, lowercase, and %u is uppercase User#19524 175 — 5y
0
I think [ and ] are a part of the character matching library or whatever it's called so probably. string.find("%[%+%]") Pejorem 164 — 5y

Answer this question