This hasn’t caused any issues as of yet, but I am curious as to why this is happening.
Here I am looking to see if I have all the information I need about a player in a table.
local function claimPlot(Player, Claimed:Folder)
if PlayerDetails[Player.Name].Plot == nil then
PlayerDetails[Player.Name].Plot = Plot.New(PlayerDetails[Player.Name], Claimed)
Claimed.Control.Tag.SurfaceGui.TextLabel.Text = Player.Name
Tween:Create(Claimed.Control.Door, TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {Position = Claimed.Control.Door.Position + Vector3.new(0,10,0)}):Play()
Claimed.Control.Door.Open:Play()
return true
end
end
The information its looking for is created by this module.
local Player = {}
Player.__index = Player
Player.dataTemplate = {
["Rooms"] = 1
}
function Player.New(ply, Data)
local self = setmetatable(Player,{})
self.Player = ply
self.CurrentAnim = nil
self.Data = Data
self.Plot = nil
return self
end
My concern is when I put a breakpoint and open up the watch window this happens.
Just so I can inherent the functions from the original module.
local function onPlayerAdded(Player:Player)
local wrap = PlayerManager.New(Player, PlayerManager.dataTemplate)
PlayerDetails[wrap.Player.Name] = wrap
if Player.Character then
onCharacterAdded(Player.Character)
else
Player.CharacterAdded:Connect(onCharacterAdded)
end
end
The __index should omitted when setting the metatable right? Ill take another look at the lua manual, but I am not sure how that would be possible with what I have.