I’m having trouble in figuring out why this is saying a function is missing a end, as every if statment has a proper end following it. Am I missing something or no? Here is the code:
local this = {}
this.__index = this
local rs = game:GetService("ReplicatedStorage")
local PlrSer = game:GetService("Players")
local RATE = 0.1
function this.Init(point, team0, team1)
local newThis = {}
setmetatable(newThis, this)
newThis.Point = point.PrimaryPart
newThis.progress = Instance.new("NumberValue", point)
newThis.progress.Name = "progress"
newThis.Owner = Instance.new("ObjectValue", point)
newThis.Owner.Name = "Owner"
newThis.team0 = team0
newThis.team1 = team1
local OG_CFG = require(point.PointCfg)
newThis.Owner.Value = OG_CFG["DefaultOwner"]
newThis.Radius = OG_CFG["Diamiter"] /2
return newThis
end
function this:Update(dt)
local team0CurPlrNum = 0
local team1CurPlrNum = 0
--for _, v in PlrSer:GetChildren() do -- get valid players
-- if v.Character ~= nil then
-- if v.Character:FindFirstChild("Humanoid") then
-- if (v.Character.HumanoidRootPart.CFrame.Position - self.Point.CFrame.Position).Magnitude <= self.Radius then
-- if v.Team == self.team0 then
-- team0CurPlrNum +=1
-- elseif v.Team == self.team1 then
-- team1CurPlrNum +=1
-- end
-- end
-- end
-- end
--end
local deltaPLrs = math.abs(team0CurPlrNum-team1CurPlrNum)
local pointsToAdd = (deltaPLrs * RATE) * dt
if team0CurPlrNum > team1CurPlrNum then
--if self.Owner.Value == self.team0 and self.progress.Value > 0 then
-- self.progress.Value -= pointsToAdd
--else
-- self.progress.Value += pointsToAdd
--end
else if team0CurPlrNum < team1CurPlrNum then
-- if self.Owner.Value == self.team1 and self.progress.Value > 0 then
-- self.progress.Value -= pointsToAdd
-- else
-- self.progress.Value += pointsToAdd
-- end
end
----FIxes negitive numbers
--if self.progress.Value < 0 then
-- self.progress.Value = 0
--end
end -- <-- says I need to add another end here
return this
This is what studio says: