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

How do I put a players decal on a brick when they click something?

I've got no idea on where to start. Any help would be great ????

1 answer

Giving out free scripts isn't exactly promoted, this website mainly focuses on assisting people with errors within their script editing it. But I'll give you this. (This will not help you to develop your scripting by just asking for a free line of code you can copy and paste.) Here's the idea, say you already have the part in the workspace you want the decal to go on the first step is to define the part and make it into a variable.

Example:

local part =  game.Workspace.Part

Now that you've defined the part you want the decal to go on, you want something you click on it can either be the same part or a different one. I will be using another part names "Part2". Therefore making your second variable.

local part =  game.Workspace.Part
local part2 = game.Workspace.Part2

Instancing, making the click detector and the decal. First, we'll start with the click detector, a child of Part2 (Meaning it is under Part2).

local part =  game.Workspace.Part
local part2 = game.Workspace.Part2

local ClickDetector = Instance.new("ClickDetector", part2) -- created the clickdetector and its parent

We have now two parts: "Part" and another named "Part2"; Part is the object where the decal will be on and Part2 will be the button to click. We have to code something that tells the script that the Click Detector has been clicked. which is ClickDetector.Clicked. Inside we put what the script will do when Part2 is clicked upon which is, instancing a decal under Part.

local part =  game.Workspace.Part
local part2 = game.Workspace.Part2

local ClickDetector = Instance.new("ClickDetector", part2) -- created the clickdetector and its parent

ClickDetector.Clicked:Connect(function()
	local decal = Instance.new("decal", part)
	decal.Texture = rbxassetid://123 -- you may find the decal you want within library and replace the number

end)

Not sure if this 100% works, wrote this at night and just on the website reach out to me if you have problems with the code. Hopefully, this helped you understand a bit of Lua have a great day.

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