I want to make an ability for earth that will summon earth spikes from underneath, but for that I need to check if the character is standing on the ground using the Raycast, I have tried it many times but I don’t understand why, raycast is facing direction up and checking if part is above the player, but I want it to check if it’s under the player, I can’t find solution for a long time so I would appreciate help. Here’s the script:
debounce.Value = true
local prparams = RaycastParams.new()
prparams.FilterType = Enum.RaycastFilterType.Exclude
prparams.FilterDescendantsInstances = {
character:GetChildren()
}
local prdir = (character:GetPivot() * CFrame.new(0, 3.25, 0)).Position
local prr = workspace:Raycast(character["Right Leg"].Position, prdir, prparams)
print(prr)
wait(0.1)
debounce.Value = false
if prr ~= nil then
--local earthspikes = game:GetService("ServerStorage").EarthSpikes:Clone()
--earthspikes.Parent = workspace
--earthspikes.CFrame = character:GetPivot() * CFrame.new(0, 5, -22.5)
wait(0.1)
debounce.Value = false
end