You can write your topic however you want, but you need to answer these questions:
-
I would like it to work if the bullet hits you not if you walk into it
-
you have to walk into the bullet for it to kill you or even register that the ray hit you
-
Ive tried not looping it, which did nothing, i tried throwing it in a coroutine just cause and thats it.
heres the code chunk
while wait() do
local ray = Ray.new(bullet.Position,bullet.CFrame.LookVector*9)
local hit,pos = workspace:FindPartOnRayWithIgnoreList(ray,{char})
if hit and hit.Parent == nil then
elseif hit and hit.Parent:findFirstChild("Humanoid") and hit.Parent.Name ~= char.Name and hit.Parent.Name ~= "Glock" and deb == false and hit.Parent.Humanoid.Health > 1 then
deb = true
hit.Parent.Humanoid.Health = 1
plyr.stats.gun_folder.ammo.Value = plyr.stats.gun_folder.ammo.Value + 1
plyr:WaitForChild("leaderstats"):WaitForChild("Gun Kills").Value = plyr:WaitForChild("leaderstats"):WaitForChild("Gun Kills").Value + 1
print("found")
bullet:Destroy()
deb = false
elseif deb == true then
print("nosir")
else
end
end