-
the problem is that when shooting a player in the head it detects the accessories my player added script my script adds the accessories to a collision group (That script works perfectly)
RemoteEvents Server
local RayParams = RaycastParams.new()
RayParams.FilterType = Enum.RaycastFilterType.Blacklist
RayParams.CollisionGroup = "Accessories"
Remotes.Shoot.OnServerEvent:Connect(function(player, BarrelPosition, direction)
local result = game.Workspace:Raycast(BarrelPosition, direction, RayParams)
if result then
if result.Instance.Name == "Head" then
local HeadShotSound = Sounds.Headshot:Clone()
HeadShotSound.Parent = result.Instance
HeadShotSound:Destroy()
result.Instance.Parent.Humanoid:TakeDamage(1000)
end
print(result.Instance)
end
end)
PlayerAdded ServerScript
local PhysicsService = game:GetService("PhysicsService")
game.Players.PlayerAdded:connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(character)
for _, Accessory in pairs(character.Humanoid:GetAccessories()) do
PhysicsService:SetPartCollisionGroup(Accessory.Handle, "Accessories")
end
end)
end)
- I tried to look in other raycast scripts of mine but I didn’t find anything neither in the devforum