Functions not running when I call them?
This question has been solved by the original poster.
I've once more come here to ask about my fall damage. the problem I'm having now is that I want it so if a command is run it puts you on a list that makes it so you no longer have fall damage. I have the command system working, but my function doesn't run when it should.
01 | local HeightRequired = 10 |
02 | local DamageScale = 2.5 |
06 | script.New.Changed:Connect( function () |
07 | for index = 1 , #exluded, 1 do |
08 | if new.Value ~ = exluded [ index ] and index = = #exluded then |
09 | for i, plr in pairs (game.Players:GetPlayers()) do |
10 | if new.Value = = plr.Name then |
11 | table.insert(exluded, #exluded + 1 , new.Value) |
12 | print ( "added " ..new.Value.. " to exluded list" ) |
17 | elseif new.Value = = exluded [ index ] then |
18 | print (new.Value.. " is already on exlude list" ) |
24 | game.Players.PlayerAdded: Connect( function (Player) |
25 | Player.CharacterAdded: Connect( function (Character) |
26 | local HumanoidRootPart = Character:WaitForChild( 'HumanoidRootPart' ) |
27 | local Humanoid = Character:WaitForChild( 'Humanoid' ) |
31 | Humanoid.FreeFalling:Connect( function (Active) |
33 | StartJump = HumanoidRootPart.Position.Y |
35 | local JumpHeight = StartJump - HumanoidRootPart.Position.Y |
37 | if JumpHeight > HeightRequired and Humanoid.FloorMaterial ~ = Enum.Material.SmoothPlastic then |
38 | for index = 1 , #exluded, 1 do |
39 | if Humanoid.Parent.Name ~ = exluded [ index ] and index = = #exluded then |
40 | Humanoid:TakeDamage((JumpHeight - HeightRequired)*DamageScale) |
42 | elseif Humanoid.Parent.Name = = exluded [ index ] then |
I can't seem to find the error in this mainly because nothing comes up in the output, my fall damage just stops working even if I'm not on the list.
as always any help is appreciated.