I’m creating a game where players can come and spray paint the walls of the buildings. I’m still testing it out, however, I came upon a small issue. The “paint” parts are stacking on top of each other.
local userInputService = game:GetService("UserInputService")
local mouseVP = userInputService:GetMouseLocation()
local mouseRay = workspace.CurrentCamera:ViewportPointToRay(mouseVP.x, mouseVP.y)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {workspace.SprayPaint} -- Put the new spray paint parts in that model so it can ignore them
local result = workspace:Raycast(mouseRay.Origin, mouseRay.Unit.Direction * 300, params)
The hit part would be result.Instance and the intersection position result.Position.
Also, if you want the spray paint to be visible for everyone, you should make the client fire to a remote event and create the part there.