Hey!
I have a Local Script that will perform a raycast to see if there are players infront of the Player. This works perfect on players that don’t have accessories, however it often gets stuck on players that do.
local function PunchAction()
if IsPunching == false and Character.CanPunch.Value == true then
IsPunching = not IsPunching
PunchTrack:Play()
Remote:FireServer()
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {Character}
local Origin = Character.HumanoidRootPart.Position
local Direction = Character.HumanoidRootPart.CFrame.LookVector * 7.5
local Result = workspace:Raycast(Origin, Direction, Params)
if Result then
if Result.Instance then
local Part = Result.Instance
if Part.Parent:FindFirstChild("Humanoid") or Part.Parent.Parent:FindFirstChild("Humanoid") then
local Enemy = Part.Parent:FindFirstChild("Humanoid")
if not Enemy then return end
if Enemy.Parent.Name == Player.Name then return end
if Enemy.Parent.Invulnerable.Value == true then return end
if Player.Character.RagdollTrigger.Value == true then return end
Remote:FireServer(Enemy)
end
end
end
task.wait(0.25)
IsPunching = not IsPunching
end
end
I have already tried simply deleting the users accessories, however I feel like there is a better fix that I just can’t seem to find out.