Hello fellow developers! I am making a spray bottle, and it’s working, the only problem I have that when you spray around corners, it looks weird, here’s a screenshot:
I want to wrap it, but I don’t know how to achieve that. Any help would be appreciated, here’s the code:
local player = game:GetService("Players").LocalPlayer
local Mouse = player:GetMouse()
local wallDetector = script.Parent:WaitForChild("WallDetector")
local sprayPaint = script.Parent
sprayPaint.Activated:Connect(function()
local ray = Ray.new(Mouse.UnitRay.Origin, Mouse.UnitRay.Direction * 40)
local hit, pos, normal = workspace:FindPartOnRayWithIgnoreList(ray, {sprayPaint, player.Character})
if hit then
local primary = game:GetService("ReplicatedStorage").Prim:Clone()
primary.CFrame = CFrame.new(pos, pos + normal)
primary.Parent = workspace
end
end)