I’m Having Trouble with my ability, which is a sukuna style cut ability that when you click on someone it deals 5 damage and plays a sound. The issue is whenever the raycast / mouse.Target encounters an accessory it freaks out… or should i say doesn’t freak out because it doesn’t do ANYTHING. i have tried multiple ways of checking if its an accessory and finding the humanoid if it is but nothings working
for context, i don’t want the accessories to trigger it, but i want the raycast to be able to go through it and hit the humanoid if it were angled right to do that, like shown in the vid below, so simply i want it to go through the front accessory but obviously i don’t want the trail to trigger it.
Here is a example of me doing this and getting the print statements:
And Here Is My Code:
local tool = script.Parent
local RemoteEvent = tool["cut sorcery event"]
RemoteEvent.OnServerEvent:Connect(function(player, mouseTarget)
print("Target:",mouseTarget,"Target Parent:", mouseTarget.Parent)
if mouseTarget.Parent:FindFirstChild("Humanoid") then
local humanoid = mouseTarget.Parent.Humanoid
local humanoidRootPart = mouseTarget.Parent.HumanoidRootPart
local sound = Instance.new("Sound")
-- sound stuff
sound.Parent = humanoidRootPart
sound.Volume = 0.75
sound.RollOffMaxDistance = 75
sound.RollOffMinDistance = 0
sound.RollOffMode = Enum.RollOffMode.Linear
-- finisher check
if humanoid.Health <= 15 then
sound.SoundId = "rbxassetid://5754301788"
sound:Play()
humanoid:TakeDamage(100)
else
sound.SoundId = "rbxassetid://935843979"
sound:Play()
humanoid:TakeDamage(5)
end
end
end)
Local Script firing the server:
local tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
local RemoteEvent = tool["cut sorcery event"]
local debounce = false
tool.Activated:Connect(function()
if not debounce then
local mousePos = mouse.Target
RemoteEvent:FireServer(mousePos)
debounce = true
task.delay(0.15, function()
debounce = false
end)
end
end)
Please help me solve this issue!