This script 'ere finds the B0 from the IntValue called "pimppi". It increases the number after B by 2. But the issue is, how can I not affect the other values of pimppi? Line 16 nulls all the other values when B0 is changed. I could do the same for the other values in pimppi as I did to B0 here, but later on, that would be messy as hell. How do I do it with string.match? This is a really messy script anyway, I'm just trying to learn string manipulation!
Thank ye!
local clickDetector = script.Parent.ClickDetector
local number = "%d+"
local letter = "%w"
local stats = script.Parent.pimppi
local s = stats.Value
local function onMouseClick(player)
local Kappa = ( string.match(s, "B%w+") )
local Heathen = (string.match(Kappa, number) )
local Stender = (string.match(Kappa, letter) )
local bob = ("".. Stender .."".. Heathen + 2 .."")
Kappa = bob
s = ("A0 ".. Kappa .." C0 D0 E0")
print(Heathen)
print(Stender)
print("Kappa: " ..Kappa)
print(bob)
print(s)
end
clickDetector.MouseClick:connect(onMouseClick)

1 comment
I would suppose you would use gsub, example s:gsub('B%d+', 'B' .. Kappa) The example would find B then any number following it in the string, then replace it with B, then the 'Kappa' you wanted. Though string manipulation isn't one of my strong suits, it might be beneficial to your problem.