PetCharacterController
PetCharacterController is a module script that manages pet characters in Highrise Studio. It handles pet creation, outfit changes, and provides methods to retrieve pet information. This is a module script that can be required in your Lua code.
Properties
Event that fires when a pet is created.
local PetCharacterController = require("PetCharacterController")
PetCharacterController.PetCreatedEvent:Connect(function(petInfo)
print("Pet created for player: " .. tostring(petInfo.player))
end)
Event that fires when a pet's outfit is changed.
local PetCharacterController = require("PetCharacterController")
PetCharacterController.PetOutfitChangedEvent:Connect(function(petInfo)
print("Pet outfit changed for: " .. tostring(petInfo.character))
end)
Methods
Retrieves pet information for a specific player.
local PetCharacterController = require("PetCharacterController")
local petInfo = PetCharacterController.GetPetForPlayer(player)
if petInfo then
print("Player has pet: " .. tostring(petInfo.character))
end
Parameters
player
Returns
any[]
The pet info, containing:
- player (Player): The player that owns the pet
- character (Character): The character that represents the pet
- outfit (CharacterOutfit): The outfit of the pet
- traits (string[]): The traits of the pet
- characterChangedEvent (Event): The event that is fired when the character changes
- petOutfitChangedEvent (Event): The event that is fired when the pet outfit changes
Retrieves pet information from a character instance.
local PetCharacterController = require("PetCharacterController")
local petInfo = PetCharacterController.GetPetFromCharacter(character)
print("Pet owner: " .. tostring(petInfo.player))
print("Pet traits: " .. tostring(petInfo.traits))
Parameters
character
Returns
any[]
The pet info, containing:
- player (Player): The player that owns the pet
- character (Character): The character that represents the pet
- outfit (CharacterOutfit): The outfit of the pet
- traits (string[]): The traits of the pet
- characterChangedEvent (Event): The event that is fired when the character changes
- petOutfitChangedEvent (Event): The event that is fired when the pet outfit changes
Updated 13 days ago