Hello
I have a module that I am trying to run in my main game script, which has a function inside of it that I am trying to run which is self:HandlePlayers()
, but again for some reason it keeps saying
Main Game Script where I call it:
Main Game Script where I defined it:
Module:
local Hardpoint = {}
Hardpoint.__index = Hardpoint
local TimerText = game.Workspace:WaitForChild("Game Notes").TimerText
local HardpointFolder = game.Workspace:WaitForChild("Game Notes"):WaitForChild("Hardpoint")
local SixthScore = HardpointFolder:WaitForChild("SixthScore")
local PraetorianScore = HardpointFolder:WaitForChild("PraetorianScore")
local OwnerValue = Hardpoint:WaitForChild("Owner")
function Hardpoint.new()
local self = setmetatable({}, Hardpoint)
self.Finished = false
self.CurrentTime = 0
self.RoundLength = 10 * 60--0
self.SwitchTime = 1.5 * 60
self.ChangeTime = 1 * 60
self.HardpointTime = 0
self.Players = {}
self.Red = {}
self.Blue = {}
self.LastTeamAdded = self.Red
self.PlayerConnection = nil
self.PossibleHardpoints = nil
self.Hardpoint = nil
self.RedPoints = 0
self.BluePoints = 0
SixthScore.Value = 0
PraetorianScore.Value = 0
self.First = true
self.LastOwner = nil
self.PlayersInHardpoint = {}
self.Owner = "none"
self.SameOwnerTime = 0
TimerText.Value = "Hardpoint"
self:HandlePlayers()
return self
end
function Hardpoint:HandlePlayers()
print("Alpha")
for i, player in ipairs(game.Players:GetPlayers()) do
table.insert(self.Players, player)
end
self.PlayerConnection = game.Players.PlayerAdded:connect(function(player)
table.insert(self.Players, player)
end)
end
return Hardpoint