if prot then
if prot == 0.1 then
humanoid.Parent.Shield.Health.Value -= damage/1.3
else
humanoid.Health -= (damage*prot)
end
else
humanoid.Health -= damage
end
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
task.wait(3)
while task.wait(0.1) do
local humPart = char:FindFirstChild("HumanoidRootPart")
local humanoid = char:FindFirstChild("Humanoid")
if humPart and humanoid then
warn("--------------------------------")
warn(humPart.Velocity.Y)
if humPart.Velocity.Y <= -60 then
while task.wait(0.1) do
warn("inloop")
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {char}
local raycastResult = workspace:Raycast(humPart.Position,humPart.Position + Vector3.new(0,-7,0),rayParams)
if raycastResult then break end
end
humanoid:TakeDamage(25)
end
end
end
end)
end)
So far, it works super well when you’re jumping off of a high spot in the lower part of the map in my game, but when you go to this certain top part, it just gets stuck in its while loop continuously warning, “inloop” although I am on land and the raycast should be working fine.
The reason why this is custom instead of a .FreeFalling thing is because it needs to be compatable with ragdolling.