Jump to content

string:gsub


Negriukas

Recommended Posts

Posted

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 "_"

Screw putin

Posted

Try replacing this line

 playerName = playerName:gsub ( v[1], v[2] ) 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

You're welcome

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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...