Forest Logo
search
package_2

spectatingsystem

By @cocacolarocks19

Roblox

Mirrored from Wally

SpectatingSystem

Setup

Place this package somewhere both server and client can require, such as ReplicatedStorage. Require it from a server Script and start the server module:

local SpectatingSystem = require(game.ReplicatedStorage.SpectatingSystem)
SpectatingSystem.server.start()

From a LocalScript, require the same package. The client module exposes camera controls for your own UI:

local SpectatingSystem = require(game.ReplicatedStorage.SpectatingSystem)
local spectating = SpectatingSystem.client

spectating.start()
-- Connect these to buttons or key bindings:
spectating.next()
spectating.previous()
spectating.stop()

spectating.isActive(true) starts spectating, spectating.isActive(false) stops it, and spectating.isActive() reads the current state. If a ScreenGui named SpectatingGui is under the local player's PlayerGui, the client automatically connects Container.Next.Hitbox and Container.Previous.Hitbox and updates the Container.PlayerName text label. Hitbox can be a GuiButton or another GuiObject.

start() returns false when no other player has a living character. getTarget() returns the currently watched Player, and isActive() reports whether spectating is on. The server creates its RemoteEvent when server.start() runs. Players are allowed by default; set Config.AllowByDefault to false to deny everyone by default, then call server.setPlayerEnabled(player, true) for permitted players. Calling server.stop() disconnects no event connections; it is intended for one-time server startup/shutdown workflows.

The client module changes workspace.CurrentCamera only while spectating and restores the local character's Humanoid when stopped. It sorts targets by UserId for stable next/previous cycling.

Package Details

Install command (Click to copy)


Version

0.0.1

License

MIT

check_circle

Safe for commercial use

infoThe package archive does not include its license text; the license is declared in its manifest metadata.

Automated license review — not legal advice.