How to Print First Part of HttpService:GenerateGUID()?

Is there a way to print the only first part of a HttpService:GenerateGUID()?

For example, I generated {5ae76737-b926-43e8-8048-9e466e4894ad}, and I only want to print the first section 5ae76737.

print(
  game:GetService("HttpService"):GenerateGUID(false):split("-")[1]
)
2 Likes

Thanks, but it still shows {, is there any way to get rid of that?

Pass false into :GenerateGUID(). It’s the parameter that controls whether brackets are included.

1 Like

Oh I didn’t even see that mb, thank you for the help

You could use string library:

local firstString = string.split(YOUR_GUID, '-')[1]
-- output if we print now: "{0hso398"

Then,

local cleanedString = string.gsub(firstString , '{', '')
print(cleanedString)
-- output: "0hso398"

That should work. Remember always to see the documentation for further info about the string library.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.