Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to add an decal on a brick with an script?

I tried do add more custom brick propeties to it in the script but when the decal part comes it went wrong.

Everything in the script works fine until it get to:

Instance.new("Decal", part)
Texture = asset
Face = "Top"

Full script:

wait(2)
workspace:WaitForChild("PartStorage")
local asset = 383058488
while true do
	wait(0.5)
	local part = Instance.new("Part",script.Parent.Parent.Parent.TixStorageA)
	local Tix = Instance.new("IntValue",part)
	Tix.Name = "Tix"
	Tix.Value = 1
	part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1,0)
	part.Material="SmoothPlastic"
	part.Transparency = 0
	part.formFactor = "Custom"
	part.BottomSurface = 0
    part.TopSurface = 0
	part.BrickColor = BrickColor.new("Bright yellow")
	Instance.new("Decal", part)
	Texture = asset
	Face = "Top"
	part.Size=Vector3.new(1,1,1)
	game.Debris:AddItem(part,450)
end

Thanks

1 answer

✓ Accepted answer

You have no reference to your decal

You've created a decal with Instance.new, and then didn't do anything with it. Luckily for us, Instance.new returns the value of the object you created, so we can easily create a reference to the object by giving it a variable, like this:

local Decal = Instance.new("Decal",part) -- Best to make this a local variable, so we don't have to deal with data leakage outside the current scope. Now we can use "Decal" to reference the decal you've created.

Decal.Texture = asset
Decal.Face = "Top"

Hope that helped.

1 comment

0

also for those needed it, you now need to make the parent of the decal workspace or the part or it wont appear

This discussion is preserved as it was. New answers, comments, and votes are closed.