print('d')
local dmg
local e = RaycastParams.new()
if headshot == true then
dmg = origDmg * 2
else
dmg = origDmg
end
for i,v in pairs(workspace:GetDescendants()) do
if v:FindFirstAncestorOfClass('Model') and v:FindFirstAncestorOfClass('Model'):FindFirstChildOfClass('Humanoid') then
local _table = {}
local t = 1
t = t + 1
table.insert(_table,1,plr.Character)
table.insert(_table,t,v)
e.FilterDescendantsInstances = _table
end
end
e.FilterType = Enum.RaycastFilterType.Blacklist
e.IgnoreWater = false
local rayDirection = origPos - pos * 500
local raycastResult = workspace:Raycast(origPos, rayDirection, e)
if raycastResult then
print('e')
local hitPart = raycastResult.Instance
if hitPart and hitPart:FindFirstAncestorOfClass('Model') then
local hitParent = hitPart:FindFirstAncestorOfClass('Model')
print('f')
print(hitParent.Name)
local hum = hitParent:FindFirstChild('Humanoid')
if hum then
local dmgUI = game.ReplicatedStorage.DMG_UI:Clone()
dmgUI.Parent = hitParent:FindFirstChild('Head')
dmgUI.dmg.Text = '<b>-'..dmg..'</b>'
hum.Health = hum.Health - dmg
end
end
end
end)
What happens: https://streamable.com/8d2upy