So i have this “ServerObject” value, that i wish i create more of, just like how you would with Vector3.new() and that sorta stuff.
Instead, the object that it returns is the base itselve. meaning that chaning one changes all of them.
I change one of them in an array of multiple of them → refers back to the original → it changes all of them.
So how can i make this work, so it only changes one?
ServerObject.New = function(Players,Rating,Owner,Number)
local this = ServerObject
this.Players = Players
this.Rating = Rating
this.Owner = Owner
this.Number = Number
return this
end
NewServerEvent.OnServerEvent:Connect(function(Player)
game.ReplicatedStorage.Servers.Value += 1
local A = game.ReplicatedStorage.Servers.Value --ServerCount
local ServerObj = ServerObject.New({Player,nil,nil,nil},0,Player,A)
table.insert(TotalServers,game.ReplicatedStorage.Servers.Value,ServerObj)
NewServerEvent:FireAllClients(ServerObj)
end)