So I am Having Problems with my Table System
I am also having this error It is in output-copied here to find below:
16:40:38.419 - ServerStorage.Server-Modules.Modules.Internals.SkillsModule:9: attempt to index nil with 'Debounce'
16:40:38.422 - Stack Begin
16:40:38.423 - Script 'ServerStorage.Server-Modules.Modules.Internals.SkillsModule', Line 9
16:40:38.424 - Script 'ServerScriptService.Server-Scripts.Scripts.Skills.SkillsScript', Line 13
16:40:38.425 - Stack End
and here is my Code Snippet of where the Error Happens
table.insert(BigTable, Player.Name) -- Line 13!
BigTable[Player.Name].Debounce = false
Full Code:
local module = {}
local BigTable = {}
local SIGNAL_EVENT = game.ReplicatedStorage.Events.Signal
module.Boomerang = function(Player)
if Player then
table.insert(BigTable, Player.Name)
BigTable[Player.Name].Debounce = false
if BigTable[Player.Name].Debounce == true then return end
SIGNAL_EVENT:InvokeClient(Player, "Boomerang")
BigTable[Player.Name].Event = function()
SIGNAL_EVENT.OnServerInvoke = function(Player, SignalType)
if SignalType == "TweenPlaying" then
BigTable[Player.Name].FinishedSignal = true
BigTable[Player.Name].Debounce = true
end
end
end
repeat wait() until BigTable[Player.Name].FinishedSignal == true
BigTable[Player.Name].FinishedSignal = false
pcall(function()
BigTable[Player.Name].Event = nil
end)
for _, ToolsAvailable in pairs(Player.Character:GetChildren()) do
if ToolsAvailable:IsA("Tool") then
BigTable[Player.Name].CurrentTool = ToolsAvailable
end
end
BigTable[Player.Name].CurrentTool.Handle.Spinning.Disable = false
BigTable[Player.Name].Event = BigTable[Player.Name].CurrentTool.Handle.Touched:Connect(function(hit)
if hit.Parent:IsA("Model") then
local PlayerReal = game.Players:GetPlayerFromCharacter(hit.Parent)
if PlayerReal and PlayerReal.Name ~= Player.Name then
if BigTable[PlayerReal.Name].HitDebounce == false then
local Humanoid = hit.Parent.Humanoid
BigTable[Player.Name].CurrentTarget = PlayerReal.Name
BigTable[PlayerReal.Name].HitDebounce = true
Humanoid:TakeDamage(30)
delay(1, function()
BigTable[PlayerReal.Name].HitDebounce = false
end)
end
end
end
end)
BigTable[Player.Name].Event = function()
SIGNAL_EVENT.OnServerInvoke = function(Player, SignalType)
if SignalType == "TweenFinished" then
delay(2, function()
BigTable[Player.Name].Debounce = false
BigTable[Player.Name].Event = nil
BigTable[Player.Name].CurrentTool.Handle.Spinning.Disable = true
BigTable[Player.Name].CurrentTool.Handle = nil
if BigTable[Player.Name].CurrentTarget ~= nil then
local PlayerTargetObject = game.Players:FindFirstChild(BigTable[Player.Name].CurrentTarget)
end
end)
end
end
end
end
end
return module
and based on one of my topics here:
https://devforum.roblox.com/t/how-to-insert-an-table-into-an-table/812344/9
that anything you insert into an table will exist and not be null
Is there anyway to fix this issue or not?
Any Help is Appreciated Thanks!