local LuckData:StringValue = UserData:WaitForChild("Luck")
local i=0
for numberStr in string.gmatch(LuckData.Value, "[^,%s]+") do
if tonumber(numberStr)==2 then
local startPos, endPos = string.find(LuckData.Value, i)
local sb = string.sub(LuckData.Value,startPos,endPos )
LuckData.Value = sb
print(sb)
return
end
end
The Value of LuckData is “2, 4, 2”, i want it to be “4, 2” how do i do that
local LuckData:StringValue = UserData:WaitForChild("Luck")
local i=0
for numberStr in string.gmatch(LuckData.Value, "[^,%s]+") do
if tonumber(numberStr)==2 then
local split = string.split(LuckData.Value,",")
local sb = tostring(split[2])..", "..tostring(split[3])
print(sb)
return
end
end
function module.removeluck(num:number)
local UserData = SessionData:WaitForChild(tostring(Player.UserId))
local LuckData:StringValue = UserData:WaitForChild("Luck")
local i=0
for numberStr in string.gmatch(LuckData.Value, "[^,%s]+") do
if tonumber(numberStr)==num then
local split = string.split(LuckData.Value,",")
local sb = tostring(split[2])..", "..tostring(split[3])
print(sb)
return
end
end
end
when the value is “2, 4, 2” it changes into “4, 2”, but when the value is “2, 4” it changes to “4, 2” it flips idk why