Why string.gsub can't change "."

local a = v:GetFullName – ReplicatedStorage.ABC.cdef
a = string.gsub(a,“.”,“_”))
print(a) – __________________________

I wanted: – ReplicatedStorage_ABC_cdef

1 Like

It’s because it has a special purpose in string patterns as . means “Any Character”, so it will find things in your string that match that pattern, aka, every letter due to what it means, hence why it does it to everything in your string. You need to escape it by adding a percentage sign

a = string.gsub(a,"%.","_")

For it to work how you want it to

1 Like