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

making a spray paint script that applies decals to walls with a tool?

attempting to make a game where the goal is to spray paint certain locations for points and what not, I had an idea where you would equip a tool, click it on a wall and a decal would appear in a random spot, unfortunately, I'm not good at that so what I have right now is: function onClicked() script.Parent.Parent.Wall.Decal.Transparency = 0 end script.Parent.ClickDetector.MouseClick:connect(onClicked)

basically, when you click on the wall, the decal's transparency will change to 0, I'm not really satisfied with this, any suggestions?

1 answer

Hi! You Should listen if the tool is activated then listen with UIS to see if they clicked! And yes that is possible. But the decal might be stretched if you just instance it into the wall


local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local Wall
local decal = "rbxassetid://"
local mouse = player:GetMouse()

Tool.Activated:Connect(function()
       UIS.InputBegan:Connect(function(input) 
                if input.UserInputType == Enum.UserInputType.MouseButton1 then
                   print("YES")
                          if  mouse.Target.Parent.Name == "Sprayable" then -- You can put all the walls in a folder that can be sprayable  or use collections service to tag it and check the tags if its a wall
                          print(mouse.Target.Name)
                          Wall = mouse.Target
                    end
      	     end 
       end)
end

Yeah you can improve this by using collection service and doing other stuff but i gave you the general idea sorry if its a bit messed or not indented im kinda sleepy

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