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

Functions not running when I call them?

Asked by 4 years ago

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.

01local HeightRequired = 10
02local DamageScale = 2.5
03local exluded = {}
04local new = script.New
05 
06script.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")
13                    new.Value = ""
14                    break
15                end
View all 50 lines...

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.

0
So wait, is New a value? Nckripted 580 — 4y
0
Never mind, that was a stupid question. What I meant to ask was what exactly is being passed through the Active parameter? I don't have good experience with this event, so I would need to know how it works. Nckripted 580 — 4y
0
Never mind, that was a stupid question. What I meant to ask was what exactly is being passed through the Active parameter? I don't have good experience with this event, so I would need to know how it works. Nckripted 580 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

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.

0
Great! Nckripted 580 — 4y
Ad

Answer this question