Created
March 23, 2025 21:58
-
-
Save joelstransky/c37641dbe28fc0f0c1d4c092933123b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onStart() { | |
this.instance.Gyroseat.HeadsUpDisplay = true; | |
// body kits | |
this._kit = this.instance.FindFirstChild("Kit") as Folder | undefined; | |
this._occupantConnection = this.instance.Gyroseat.GetPropertyChangedSignal("Occupant").Connect(() => { | |
const humanoid = this.instance?.Gyroseat.Occupant; | |
this._prompt.Enabled = humanoid === undefined; | |
if (humanoid) { | |
// character is sitting | |
// -- Get the player from the character | |
const player = Players.GetPlayerFromCharacter(humanoid.Parent); | |
if (player) { | |
this._garageDataService.showGasPedal(player); | |
if (player.UserId !== this._playerId) { | |
// theif is sitting | |
task.wait(0.1); // Slight delay to avoid exploit attempts | |
humanoid.Sit = false; | |
task.wait(0.1); // Slight delay to avoid exploit attempts | |
player.Character?.PivotTo( | |
new CFrame(this.instance.Gyrosphere.Position.add(new Vector3(0, 25, 5))), | |
); // Teleport out | |
this.resetSeat(); | |
} else { | |
// owner is sitting | |
// this._prompt.Enabled = false; | |
this.instance.Gyroseat.SetNetworkOwner(player); | |
this.instance.Gyrosphere.SetNetworkOwner(player); | |
// humanoid.SetStateEnabled(Enum.HumanoidStateType.Jumping, false); | |
// humanoid.JumpPower = 0; | |
this.resetSeat(); | |
} | |
} | |
// -- Reset ownership when seat is unoccupied | |
else { | |
// this._prompt.Enabled = true; | |
this.instance.Gyroseat.SetNetworkOwnershipAuto(); | |
this.instance.Gyrosphere.SetNetworkOwnershipAuto(); | |
// humanoid.SetStateEnabled(Enum.HumanoidStateType.Jumping, true); | |
// humanoid.JumpPower = 50; | |
this.resetSeat(); | |
} | |
} else { | |
// character is standing | |
if (this._playerId) { | |
const player = Players.GetPlayerByUserId(this._playerId); | |
player && this._garageDataService.hideGasPedal(player); | |
} | |
// this._prompt.Enabled = true; | |
this.resetSeat(); | |
} | |
}); | |
print("server gyrosphere component started", Players.LocalPlayer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment