Can't spawn a decal inside a spawned part

Im trying to make a part spawn with a decal.
The script looks like this.

local money = Instance.new(“Part”)
money.material = Enum.material.glass
money.Color = Color3.fromrgb(86,255, 7)
money.Position = Vector3.new(0,30,0)
money.Parent = game.workspace

wait(1)

local b = instance.new(“Decal”)
b.texture = 1475447571
b.parent = money.topsurface

It spawns the part but the decal is nowhere to be seen. The debugger tags the money variable.

remove topsurface in

b.parent = money.topsurface
--to: b.parent = money

and add this in place of the face, not the parent (keep both lines):

b.Face = Enum.NormalId.Top

and you should end up with

b.parent = money
b.Face = Enum.NormalId.Top

Textures need to be formatted correctly. “rbxassetid://id”. In your case “rbxassetid://1475447571”.
There are also quite a lot of capitalization errors in the script you sent. Applying what pog cat said too we end up with:

local money = Instance.new("Part")
money.Material = Enum.Material.Glass
money.Color = Color3.fromRGB(86,255, 7)
money.Position = Vector3.new(0,30,0)
money.Parent = game.workspace

wait(1)

local b = Instance.new("Decal")
b.Texture = "rbxassetid://1475447571"
b.Parent = money
b.Face = Enum.NormalId.Top

1 Like

With @Azarctic’s code it seems to work fine

SpawnBlockWithDecal.rbxl (42.9 KB)

image

local money = Instance.new("Part")
money.Material = Enum.Material.Glass
money.Color = Color3.fromRGB(86,255, 7)

local b = Instance.new("Decal")
b.Texture = "rbxassetid://1475447571"
b.Parent = money
b.Face = Enum.NormalId.Top

while true do
	local drop = money:Clone()
	drop.CFrame = script.Parent.CFrame
	drop.Anchored = false
	drop.CanCollide = true
	game.Debris:AddItem(drop,5)
	drop.Parent = workspace
	task.wait(1)
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.