Raycast detecting parts with canquery off

im making a sentry turret that fires at the player, it detects the players accessories despite cancollide, cantouch, and canquery being disabled.
image
image

You could just blacklist the character on your raycast parameters like this:

local SentryTurret_RaycastParameters = RaycastParams.new()
SentryTurret_RaycastParameters.FilterType = Enum.RaycastFilterType.Blacklist
SentryTurret_RaycastParameters.FilterDescendantsInstances = {Character}

But where are you setting the players accessories to CanQuery false? This looks like you are only doing it one time in this script, but it doesn’t show what Child is. Is it the Player, the Player Character, or what the script refers to.

You could play test and look in your player in the Workspace (not the Player service folder) to see if those items are still CanQuery false. This would tell you if you are successfully setting that Property or not.

I think I read that things like a player’s CanCollide or Transparency has to be set every frame or something like that.

child is a descendant of character, if the descendant is a basepart. it sets canquery to false, this applies to body parts too, but it still manages to hit them somehow

edit: the script to turn off cancollide and canquery is in starter character scripts

this is what the hierarchy of most accessories should look like
image

if i blacklisted the entire character then his body parts wouldnt get hit with the raycast either, by the way its in a script not a localscript

But did you try it play testing in Studio to see if the accessories in your Character in the Workspace are CanQuery false?

if you really wan’t you can make turret face player and shoot at look vector, or use trigonometry to get angle beetween plr and turret and then rotate the turret to angle position

the accessories all have canquery off when playtesting

I already made the turret rotate in the players direction

soo make this shoot look vector of turret

that isnt the issue, he already has firing and turret rotation figured out. its just the hit detection that isnt working properly

bumping this thread because i still need help with this

nevermind, turns out i was setting canquery on the client and doing a server-sided raycast

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.