I was trying to make a part clone by using OOP, while trying to get it I came across an error. I think “self” is nil. Here is the script:
local Object = {}
Object.__index = Object
function Object.new(position,part)
local newobject = {}
setmetatable(newobject,Object)
newobject.Position = position
newobject.Part = part
return newobject
end
function Object:Spawn()
local clone = self:Clone()--Error lies here, "attempt to call a nil value"
clone.Parent = game.Workspace
end
return Object
Main script:
Object = require(game.ServerScriptService.ModuleScript)
local part = game.ServerStorage:FindFirstChild("Part")
newobject = Object.new(Vector3.new(0,0,0),part)
newobject:Spawn()
Anytime! If you have anymore issues don’t be afraid to make another post!
Also I recommend you mark @Pokemoncraft5290’s first reply to your post as the solution as he was the first one to answer the original problem in your post and rightfully deserves it