How would I make a unanchored part splat on touch

So I want to make an unanchored part splat a decal on the ground on touch, but I don’t want it to be massive, just small. How would I do this?

3 Likes

The best way to do is is to create a part at the point of impact using .Touched (I would look into raycasting, it is a lot better than touched, but it is up to you). Your code would look something like this:

local part = --Part path here 

part.Touched:Connect(function(partTouched)
    local partPosition = part.Position 
    
    local decalPart = Instance.new("Part")
    decalPart.Size = Vector3.new(4, 1, 4) --Change these to whatever 
    decalPart.Transparency  = 1
    decalPart.CanCollide = false 
    decalPart.Anchored = true 
    decalPart.Position = partPosition
    decalPart.Parent = game.Workspace 

    local decal = Instance.new("Decal") 
    decal.Texture = -- Your texture 
    decal.Face = Enum.NormalId.Top 
    decal.Parent = decalPart 
end)

Keep in mind this would only work for a part falling down on the ground. If you want it to work with all sides, use raycasting, but that is beyond the scope of this question.

1 Like

image

image

The script does not work out of the box. You have to specify a texture where I put a comment saying --Your texture I’m assuming you understand how decals work.

whoops i forgot to do that thanks

1 Like

OH CRAP ITS SPAWNING IN A SPLATTER CONSTANTLY
What the heck my game lag