Skip to content

Instantly share code, notes, and snippets.

@spotco
Created March 23, 2017 05:13
Show Gist options
  • Select an option

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

Select an option

Save spotco/f15256545344446fa7fab47a1cd50552 to your computer and use it in GitHub Desktop.
decal_to_surfacegui.lua
local selection_part = game.Selection:Get()[1]
local decals = {}
for _,child in pairs(selection_part:GetChildren()) do
if child.ClassName == "Decal" then
table.insert(decals, child)
end
end
for i=1,#decals do
local itr = decals[i]
local screengui = Instance.new("SurfaceGui",selection_part)
screengui.Face = itr.Face
screengui.CanvasSize = Vector2.new(100,100)
local img = Instance.new("ImageLabel", screengui)
img.Image = itr.Texture
img.BackgroundTransparency = 1
img.Size = UDim2.new(0,100,0,100)
end
for i=1,#decals do
decals[i]:Destroy()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment