Skip to content

Instantly share code, notes, and snippets.

@spotco
Last active June 25, 2021 05:42
Show Gist options
  • Select an option

  • Save spotco/64d1576fa7597de833dd02e82b2f75d8 to your computer and use it in GitHub Desktop.

Select an option

Save spotco/64d1576fa7597de833dd02e82b2f75d8 to your computer and use it in GitHub Desktop.
make_spdecal.lua
local function make_spdecal(cur, texture)
local string_value = cur:FindFirstChild("SPDecal")
if string_value == nil then
string_value = Instance.new("StringValue")
end
string_value.Value = texture
string_value.Name = "SPDecal"
string_value.Parent = cur
end
local function r_itr(cur)
for _,child in pairs(cur:GetChildren()) do
r_itr(child)
end
if cur.ClassName == "Decal" or cur.ClassName == "Texture" then
if cur.Texture ~= "" then
local texture = cur.Texture
make_spdecal(cur, texture)
cur.Texture = ""
end
end
if cur.ClassName == "ImageLabel" then
if cur.Image ~= "" then
local image = cur.Image
make_spdecal(cur, image)
cur.Image = ""
end
end
if cur.ClassName == "MeshPart" then
if cur.TextureID ~= "" then
local textureid = cur.TextureID
make_spdecal(cur,textureid)
cur.TextureID = ""
end
end
end
r_itr(game.Selection:Get()[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment