I am making a game where there are aerial attacks, so I used a raycast to see if the player is in the air to do the attack. But for some reason is doesn’t detect other parts other than the baseplate.
Code:
local origin = plr.Character.Torso.Position
local dest = plr.Character.Torso.Position - Vector3.new(0, 10, 0)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {plr.Character:GetChildren()}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local ray = workspace:Raycast(origin, dest, raycastParams)
if ray then
game.ReplicatedStorage.Events.M1:FireServer(false) --Normal Attack
else
game.ReplicatedStorage.Events.M1:FireServer(true) --Aerial Attack (In the air)
end
Here a Video showing the problem:
robloxapp-20240519-1358483.wmv (3.3 MB)
(The normal attack is the punch and the aerial attack is the twirl kick)
the aerial attack happens even though I am on a part that is not the baseplate.
Please let me know if there are any problems in the code. Thank you!