#Help With Raycasting

1 messages · Page 1 of 1 (latest)

versed summit
#

the raycast isn't returning anything

    local humanoidrootpart:BasePart = player.Character.HumanoidRootPart
    local explosionmodule = require(game.ServerScriptService.ExplosionModule)
    local direction = (mousepos - humanoidrootpart.Position).Unit * 1000
    local params = RaycastParams.new()
    params.FilterDescendantsInstances = {player.Character}
    params.FilterType = Enum.RaycastFilterType.Exclude
    local raycastresult = workspace:Raycast(mousepos, direction, params)
    
    if raycastresult then
        local initialpos = Vector3.new(humanoidrootpart.Position.X, humanoidrootpart.Position.Y + 50, humanoidrootpart.Position.Z)
        explosionmodule.Explosion(
            Color3.fromHex("0000ff"),
            ColorSequence.new(Color3.fromHex("0000ff")),
            1, raycastresult.Position,
            initialpos, 2.5,
            Enum.EasingStyle.Sine
        )
    end
end)```
warped echo
versed summit
#

idk

#

the raycast result never returns anything

#

pls help

warped echo
# versed summit pls help

Why are you raycasting from the mouse's position? Wouldn't you want to raycast from the root part?

merry dawn
#

YE from hrp to mousepos

versed summit
#

tank u i fixed it