Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by
Coder_1 27
4 years ago

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

Ad

Answer this question