Jump to content

string:gsub


Negriukas

Recommended Posts

Hello, So i'm making my own nametags system and i need to draw the "_" in every player name with a space, like example if my name is "Franklin_Clinton" it will draw "Franklin Clinton" etc and thanks.

This is a little part of my code

detects = { 
    { "_", " " }, 
} 
  
local playerName = getPlayerName(player) 
    for k,v in ipairs (detects) do 
        if string.find( string.lower ( playerName ),v[1]) then 
            playerName = playerName:gsub ( playerName, v[2] ) 
        end 
    end 

The problem is that it repalce the whole player name with a space and it suppose to replace only the string "_"

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...