I have a fall damage script, and I want it to not do damage if you hit a part that's inside a folder.
I do have a way to negate it already, but it delays the damage from happening for like 3 seconds, and I think that it looks sloppy to have it delayed that much.
my script right now is as follows :
local HeightRequired = 10 local DamageScale = 2.5 game.Players.PlayerAdded: Connect(function(Player) Player.CharacterAdded: Connect(function(Character) local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart') local Humanoid = Character:WaitForChild('Humanoid') local StartJump = nil Humanoid.FreeFalling:Connect(function(Active) if Active then StartJump = HumanoidRootPart.Position.Y else local JumpHeight = StartJump - HumanoidRootPart.Position.Y if JumpHeight > HeightRequired then Humanoid:TakeDamage((JumpHeight - HeightRequired)*DamageScale) end end end) end) end)
so how would I make it so you can negate the fall damage from happening when a certain part is touched?
It is easier to stop fall damage by detecting a certain material rather than detecting if the block is in a folder. You would only need to change line 16 of your code if you can compromise:
--Insert into line 16. Replace the material with the one of your choice. if JumpHeight > HeightRequired and Humanoid.FloorMaterial ~= Enum.Material.Fabric then