Make Falls Deadly in Roblox - Fall Damage Tutorial!

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ธ.ค. 2024

ความคิดเห็น • 7

  • @kungfugamer2615
    @kungfugamer2615 2 หลายเดือนก่อน +2

    Your videos help me understand studio much better.

  • @Joshdaly1
    @Joshdaly1 13 วันที่ผ่านมา

    Not sure why but when I climb down ladders I will recive fall damage. I guess since im moving down at any point i will loose health. I'm just wondering how I can make it so that someone would only loose health for falling

  • @RealBaconLite
    @RealBaconLite หลายเดือนก่อน +1

    Script?

  • @anotherpolosh
    @anotherpolosh 2 หลายเดือนก่อน

    will that work with a custom falling anim , i seen some tutorials but my falling anim is breaking all of the scripts [killing height needs to be one to work] and the script that work are rounded up so they deal 20 or 100 which i dont like

    • @duckhive-games
      @duckhive-games  2 หลายเดือนก่อน

      @@anotherpolosh yea it should. It doesn’t rely on any humanoid events or animation events to work. You can also customize the distance to fall that doesn’t cause any damage, as well as a damage multiplier so you can really tinker it to your liking. I don’t see why you couldn’t use a custom fall animation. It reads the characters humanoidrootpart’s velocity to detect when to apply damage

    • @anotherpolosh
      @anotherpolosh 2 หลายเดือนก่อน

      @@duckhive-games also i do not have time to check may u check is something is wrong here , it doesnt work but there is 0 errors : local Players = game:GetService("Players")
      local RunService = game:GetService("RunService")

      local fallThreshold = 20
      local damageMultiplier = 2

      Players.PlayerAdded:Connect(function(player)
      player.CharacterAdded:Connect(function(character)
      local humanoid = character:WaitForChild("humanoid")
      local rootPart = character:WaitForChild("humanoidRootPart")

      local isFalling = false
      local startHeight = nil

      RunService.Heartbeat:Connect(function()
      if humanoid and rootPart then
      local velocityY = rootPart.Velocity.Y

      if velocityY >= 0 then
      isFalling = false

      end

      if velocityY < -5 and not isFalling then
      isFalling = true
      startHeight = rootPart.Position.Y
      print("Started falling from height:", startHeight)

      end
      end
      end)

      rootPart.Touched:Connect(function(hit)
      if isFalling and hit:IsDescendantOf(workspace) and not hit:IsDescendantOf(character)then
      local endHeight = rootPart.Position.Y
      local fallDistance = startHeight - endHeight

      if fallDistance > fallThreshold then
      local damage = (fallDistance - fallThreshold) + damageMultiplier
      humanoid:TakeDamage(damage)
      print("Landed from fall. Distance", fallDistance, "Damage applied", damage)
      end

      isFalling = false
      startHeight = nil
      end
      end)
      end)
      end)