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.
local HeightRequired = 10 local DamageScale = 2.5 local exluded = {} local new = script.New script.New.Changed:Connect(function() for index = 1, #exluded, 1 do if new.Value ~= exluded[index] and index == #exluded then for i, plr in pairs(game.Players:GetPlayers()) do if new.Value == plr.Name then table.insert(exluded, #exluded + 1, new.Value) print("added "..new.Value.." to exluded list") new.Value = "" break end end elseif new.Value == exluded[index] then print(new.Value.." is already on exlude list") break end end end) 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 and Humanoid.FloorMaterial ~= Enum.Material.SmoothPlastic then for index = 1, #exluded, 1 do if Humanoid.Parent.Name ~= exluded[index] and index == #exluded then Humanoid:TakeDamage((JumpHeight - HeightRequired)*DamageScale) break elseif Humanoid.Parent.Name == exluded[index] then break end end end end end) end) end)
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.
I managed to fix the issue, it was simply solved by adding a dummy value into the table so that the for loops wouldn't break.