I'm trying to use a module script to create an orb object for each player and call the same methods on each individual orb object. Here's what I tried doing for the constructor of the module script.
function Orb.New(Player)
local self = setmetatable({}, Orb)
local OrbObject = Instance.new("Part")
OrbObject.Shape = ("Ball")
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
OrbObject.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
OrbObject.Parent = Character
self.OrbObject = OrbObject
self.Player = Player
self.X = 20
return self
end
In other methods, trying to reference self.X works perfectly fine, but whenever I try to access self.OrbObject, it gives me nil. What's the problem, and what should I do? Or is there a possible issue somewhere outside of the constructor?

1 comment
Maybe you can post the whole module, because I'm pretty sure the problem is not in the New() method.