Your second argument in gsub is ..., which I’m guessing is nil. gsub will replace argument 1 with argument 2, so it should be a string as well. Since you want to completely remove “-”, just replace it with “”.
local str = tostring(game:GetService("RbxAnalyticsService"):GetClientId())
print(str:gsub("%-", ""))