Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would i format %x to be a readable format for assetID's?

Asked by
VAHMPIN 277 Moderation Voter
4 years ago

code example so not request:

1local format = "%x"
2local formatted = string.format(format, "7846242414") -- fake assetID btw

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Hey, this is pretty easy to do, all you need to do add is the "#" to the x.

This makes the formatting readable, for example you can do this on an audio assetID:

1local Format = "%#x" -- turns the hex (%x) into a readable roblox format by making x = #x
2local Formatted = string.format(Format, "152745539")
3local AssetID = "rbxassetid://" .. Formatted
4 
5local Sound = Instance.new("Sound")
6Sound.Playing = true
7Sound.Looped = true
8Sound.SoundId = AssetID
9Sound.Parent = workspace
0
I'll test this now, thanks. VAHMPIN 277 — 4y
0
worked, thanks again. VAHMPIN 277 — 4y
Ad

Answer this question