Im making a Cut mark-impact thing for my game, and when i use it on skinny parts like this, it works
https://gyazo.com/7216d04e9985c514781aee00c49d3725
But when i use it on wider parts, it doesnt work for some reason.
https://gyazo.com/1e667f15c681ce510876f629acd270dc
Here is my code:
local direction = hrp.CFrame.LookVector
local ray = Ray.new(hrp.Position + direction * distance, -direction * distance)
local part,pos,normal = workspace:FindPartOnRayWithIgnoreList(ray,{character,workspace.Effects})
if ray then
if part and part.Anchored == true and part.CanCollide == true and part.Transparency == 0 and part.Parent:FindFirstChild("Humanoid") == nil and part.Parent ~= workspace.Effects then
print("cut")
local impact = game.ReplicatedStorage.Models.HitModels[weapon.Name].Impact:Clone()
impact.Parent = workspace.Effects
--impact.Position = part.Position
impact.CFrame = CFrame.new(pos, pos + normal)
impact.CFrame = impact.CFrame*CFrame.new(math.random(-50,50)/100,math.random(-50,50)/100,0)*CFrame.Angles(0,0,math.random(1,360))
local WeldConstraint = Instance.new("WeldConstraint", impact)
WeldConstraint.Part0 = impact
WeldConstraint.Part1 = part
local sound = sounds[weapon.Name].Impact:Clone()
sound.Parent = impact
sound:Play()
game.Debris:AddItem(sound,1)
game.Debris:AddItem(impact,5)
end
end
I assume its something to do with the raycast, as there are no errors and it doesnt print with the wider parts. Ill take any help, thanks!
Ps: both parts are the same part, just resized