Ride a PetDocumentation← Portfolio

#Code Reference

#Remotes

All under ReplicatedStorage.RidePetRemotes:

RemoteTypeUse
ActionRemoteFunctionThe only way the client asks for something. Action:InvokeServer(name, args) returns { ok = true, state = snapshot, … } or { ok = false, error = code }.
StateChangedRemoteEventThe server pushes a fresh snapshot of the player's state (every second, and after every action).
NoticeRemoteEventA text for the toast at the bottom of the screen.
HatchPlayRemoteEventTells every client to play the hatch ceremony for an egg model.

#Actions

ActionArgumentsDoes
GetState—Returns the snapshot.
GetRadarTargets—Returns the positions of map eggs seen by your radars.
PlaceEggAteggId, positionPuts an egg from the inventory in a nest at a point inside your base.
HatchNestnestIdHatches a ready egg.
DropEgg—Drops the egg you carry where you stand.
PlacePet / StorePetpetIdPuts a pet on the ranch / takes it off.
PlaceBest—Fills free slots with the best-earning pets.
Mount / DismountpetId / —Starts and stops riding.
FeedpetId, foodIdThe pet eats one food.
BuyFoodfoodIdBuys one food.
BuyLuckmax (optional)Buys one Hatch Luck level, or as many as you can afford when max is true.
BuyRadarradarIdBuys one radar (you can own several).
UseRadarradarIdStarts the radar: picks one egg of its rarity and shows it for 5 minutes; the radar is removed when it ends.
ClaimIndextierClaims an Index reward (rewards are also paid automatically).
Rebirth—Performs the next rebirth if the requirements are met.
Admin*see Admin PanelAdmin only.

Error codes include cash_low, nests_full, not_ready, invalid_egg, invalid_pet, invalid_food, invalid_radar, radar_active, luck_max, pet_required, max_rebirth, rate_limited, too_far, egg_gone, not_in_base, too_close and unknown_action. RidePetUI.State turns each into an English message.

#State snapshot

The table the client draws from: cash, incomePerSecond, pets, basket, nests, food, radars, index, indexEggs, claimed, rebirths, luck, petSlots, basketSlots, worldEggCounts, weather, mounted.

#Server scripts

ScriptRole
GameplayProfiles and saving, plots, map egg rolls, upgrades, the Action dispatcher
ApiShared table for the other scripts and pose helpers
PetSystemPets as tools, riding, the ranch pen, pet growth, Index rewards
EggSystemCarrying, dropping, placing and hatching eggs
WeatherSystemDay/night and storm events
AdminSystemThe admin actions
DisplayModelsCopies egg models to RidePetDisplay for the clients

#Client modules (RidePetUI)

ModuleRole
State, Windows, Util, ToastServer state, window open/close, helpers, messages
Hud, ActionBarHUD buttons and the contextual action buttons
Hotbar, InventoryHotbar with pictures and the All Items window
IndexPanel, RebirthPanel, StallPanels, StallsWindows and stall interactions
EggWorld, EggHover, PetWorld, PetRigEggs, pets and their animation in the world
PlotSignsHatch Luck sign prompts
HatchRevealPop-up when an egg hatches
NoKnockdownDisables knock-down
AdminPanelThe Admin window