Skip to content

Commit

Permalink
master
Browse files Browse the repository at this point in the history
  • Loading branch information
BazirGames authored Apr 23, 2022
1 parent 2c0df04 commit d43d110
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ export class BazirRemote {
);
}
/** @hidden */
public _GetorCreateRemote(): typeof BazirRemote.prototype.RemoteEvent {
return this._getRemote(isServer ? 0 : undefined) ?? this._createRemote();
public _GetorCreateRemote(parent?: Instance): typeof BazirRemote.prototype.RemoteEvent {
return this._getRemote(isServer ? 0 : undefined) ?? this._createRemote(parent);
}
/** @hidden */
public _updateremoteparent(parent: Instance) {
Expand Down Expand Up @@ -422,7 +422,7 @@ export class BazirRemote {
public _addChildRemote(child: Remotes): void {
const CurrentData = BazirRemotes.get(this);
if (BazirRemote.Is(CurrentData?.LastParent) || BazirRemoteContainer.Is(CurrentData?.LastParent)) {
CurrentData?.LastParent._removeChildRemote(child);
CurrentData.LastParent._removeChildRemote(child);
}
child._updateremoteparent(this.RemoteEvent);
if (isServer) {
Expand Down Expand Up @@ -488,10 +488,11 @@ export class BazirRemote {
BazirRemotes.delete(this);
}
this.Janitor.Destroy();
table.clear(this);
setmetatable<BazirRemote>(this, undefined as unknown as LuaMetatable<BazirRemote>);
//table.clear(this);
//setmetatable<BazirRemote>(this, undefined as unknown as LuaMetatable<BazirRemote>);
}
constructor(public Path: string, Parent: RemoteParent = script) {
BazirRemote.AssertParent(parent);
const mt = getmetatable(this) as LuaMetatable<BazirRemote>;
mt.__newindex = (remote, index, value) => {
warn(`[BazirRemote] ${this.Path} can't set ${index}`);
Expand Down Expand Up @@ -528,8 +529,8 @@ export class BazirRemote {
assert(typeIs(Path, "string"), `expects string, got ${type(Path)}`);
assert(Path.size() > 0, "path can't be empty");
assert(Path.size() < 256, "path can't be longer than 255 characters");
this.RemoteEvent = this._GetorCreateRemote(Parent);
this._changeparent(Parent);
this.RemoteEvent = this._GetorCreateRemote();
assert(this.RemoteEvent !== undefined, "failed to create remote event");
if (isServer) {
this.Janitor.Add(
Expand Down

0 comments on commit d43d110

Please sign in to comment.