How would Do something so that if the ray touches the player, they die?
local ray = Ray.new(pos.CFrame.p, (endPos - pos.CFrame.p).unit * 300) local hit, position = workspace:FindPartOnRay(ray, player.Character) local distance = (position - pos.CFrame.p).magnitude ball.CFrame = CFrame.new(position, pos.CFrame .p) * CFrame.new(0, 0, 1.5) * CFrame.new(0, 0, -distance) game.Debris:AddItem(ball, 1) local sT = 0 local bv = Instance.new("BodyVelocity", ball); bv.velocity = -ball.CFrame.lookVector * speed
Hi, seimmaster07! In that script put this code in here -
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then -- if a humanoid exists, then humanoid.Health = 0 -- damage the humanoid end end script.Parent.Touched:connect(onTouch)
Thank you for asking! :D