I’m trying to create a spray paint tool which allows users to spray their clan logo wherever they wish. However, I’m not sure how I would go about making the actual spray paint part’s orientation match the orientation of the hit part so there’s a part to put the decal on. I tried using the CFrame’s orientation, but it resulted in weird angles. Using the hit part’s orientation doesn’t really help either.
Client script:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
script.Parent.Activated:Connect(function()
if Mouse.Target then
if Mouse.Target:IsA("BasePart") then
if not Mouse.Target.Parent:FindFirstChild("Humanoid") then
game.ReplicatedStorage.Remotes.PlaySound:FireServer(script.Parent.Handle.Spray)
local Part = Instance.new("Part")
Part.CFrame = Mouse.Hit
Part.Anchored = true
Part.Material = Enum.Material.SmoothPlastic
Part.CanCollide = false
Part.Size = Vector3.new(4, 0.05, 4)
Part.Orientation = Mouse.Target.Orientation
Part.Parent = workspace
end
end
end
end)
NOTE: I’m aware that I should do the part creation on the server - at the moment I’m just testing.
Any help would be greatly appreciated.