Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Negating a fall damage script when you touch a certain part?

Asked by 4 years ago

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 :

01local HeightRequired = 10
02local DamageScale = 2.5
03game.Players.PlayerAdded: Connect(function(Player)
04    Player.CharacterAdded: Connect(function(Character)
05        local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart')
06        local Humanoid = Character:WaitForChild('Humanoid')
07 
08        local StartJump = nil
09 
10        Humanoid.FreeFalling:Connect(function(Active)
11            if Active then
12                StartJump = HumanoidRootPart.Position.Y
13            else
14                local JumpHeight = StartJump - HumanoidRootPart.Position.Y
15 
View all 29 lines...

so how would I make it so you can negate the fall damage from happening when a certain part is touched?

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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:

1--Insert into line 16. Replace the material with the one of your choice.
2if JumpHeight > HeightRequired and Humanoid.FloorMaterial ~= Enum.Material.Fabric then
1
works fine, but using "not" doesn't work, I simply changed it from that to using ~= instead of an == gwenniekins 59 — 4y
0
Oops, I'll correct the answer HappyHammer55555 99 — 4y
Ad

Answer this question