How to make effect strong punch example inside!

Hello, I would like to ask you if you know how to add such an effect (when you make a special blow, parts with different material appear near you or near the enemy, depending on the material, thank you for understanding) for example:

Game AUT

1 Like

Using raycasting you can check the part they are standing over. Then just check the material and color of to the part the raycast hits first to determine your effects.

Im noob can you tell me how to make it or tutorial cuz im new in studio :frowning:

Like this?

local RadialRaycastCheck = {}

type array<t> = {[number]:t} -- Array variable type
type dictionary<t> = {[string]:t} -- Dictionary variable type

local RaycastPar = RaycastParams.new()
RaycastPar.FilterType = Enum.RaycastFilterType.Blacklist

local PropertyChecks = { -- If any of these are true during the property check, it is ignored in collision
	CanCollide = false,
	Transparency = 1,
}

local function CreateCylinderArray(Position: CFrame, Height: number) -- math :c
	local PositionsArray: array<CFrame> = {}
	
	local BasePosition = CFrame.new(Position.X, 0, Position.Z)
	
	for PosY = Position.Y-Height/2, Position.Y+Height/2, Height/2 do
		for Rotation = 0, math.pi*2, math.pi/30 do
			local NewCFrame = BasePosition * CFrame.new(0, PosY, 0) * CFrame.fromEulerAnglesXYZ(0, Rotation, 0)
			table.insert(PositionsArray, NewCFrame)
		end
	end
	
	return PositionsArray
end

function RadialRaycastCheck:Check(Position: CFrame, Radius: number, Height: number, Ignore: array<any>)
	local NewCylinder = CreateCylinderArray(Position, Height)
	RaycastPar.FilterDescendantsInstances = Ignore
	
	local CollisionResult = nil -- Will be a RaycastResult 
	
	for _, CheckCFrame: CFrame in pairs(NewCylinder) do
		local RaycastResult = workspace:Raycast(CheckCFrame.Position, CheckCFrame.LookVector * Radius, RaycastPar)
		local RaycastInstance = RaycastResult and RaycastResult.Instance
		
		if RaycastInstance then
			local DidCollide = true
			
			for Property, Value in pairs(PropertyChecks) do
				if RaycastInstance[Property] == Value then
					DidCollide = false
					break
				end
			end
			
			if DidCollide then
				CollisionResult = RaycastResult
				break
			end
		end
	end
	
	return CollisionResult
end

return RadialRaycastCheck

Как это использовать