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

Can someone help me understand why this isn't working? Big juicy monkey brain no work right

Asked by 4 years ago

This question has been solved by the original poster.

I have a character ability system that works for the most part, however, for some reason I can't get my head around, this won't work. The RemoteEvent I have set up is only supposed to execute once, and then check that the ability that it's linked to is disabled, yet after the first time it completely breaks, especially if you spam it. Obviously hints towards something not being reset properly, but it is? Idk but here's the code:

001-----------------------
002-- General Variables --
003-----------------------
004 
005local player = game:GetService("Players"):WaitForChild(script.Parent.Name)
006local character = workspace:WaitForChild(player.Name)
007local humanoid = character:WaitForChild("Humanoid")
008 
009local RunService = game:GetService("RunService")
010local ServerStorage = game:GetService("ServerStorage")
011 
012local Events = game:GetService("ReplicatedStorage").RemoteEventsAndFunctions
013 
014local SetHUDProgressBar = Events.SetHUDProgressBar
015 
View all 170 lines...
1
"pairs" is used for things like the GetChildren() function. But "ipairs" are used to loop through tables efficiently. Shounak123 461 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Of course that's what caused the problem. Line 57 I put "ipairs" instead of "pairs", and now it works flawlessly. What's the lesson we learned today kiddos? Stay in school.

Ad

Answer this question