I am writing a script that creates a part and changes it's properties as needed. I also need to add a Decal to each surface (the same decal on every surface).
The PartHelpers.SmoothPart(Part)
(line #: 11) function smooth's all of the surfaces, I want to create a similar function for the Decals
Could someone please help me with the code that will add a decal to the part created with the HealthPowerup function?
local function HealthPowerup() local Part = Instance.new("Part", workspace) Part.Size = Vector3.new(3,3,3) Part.CanCollide = true Part.Position = Vector3.new(math.random(100),4, math.random(100)) Part.Shape = 0 Part.BrickColor = BrickColor.new("Bright red") Part.Transparency = .5 Part.Anchored = true PartHelpers.SmoothPart(Part) end SmoothPart = function(p) p.BackSurface = 0 p.TopSurface = 0 p.BottomSurface = 0 p.FrontSurface = 0 p.LeftSurface = 0 p.RightSurface = 0 end
I figured it out looking at some of the other Q&As here. I am including my code incase someone else has a similar questions. Feel free provide feedback, anything that would make it better code. :-)
public.DecalSurface = function(p, assetURI) local d = Instance.new("Decal", p) d.Texture = assetURI d.Face = "Front" local d = Instance.new("Decal", p) d.Texture = assetURI d.Face = "Back" local d = Instance.new("Decal", p) d.Texture = assetURI d.Face = "Left" local d = Instance.new("Decal", p) d.Texture = assetURI d.Face = "Right" local d = Instance.new("Decal", p) d.Texture = assetURI d.Face = "Top" local d = Instance.new("Decal", p) d.Texture = assetURI d.Face = "Bottom" end