I want to achieve a Pet System where u can hatch pets and equip them. I first only need help with the second part. How shall I structure this system? Where shall I put my Pet Models? Shall the Equip Mechanism be handled on the server (Pretty sure it should.)?
What I would do:
EquipButton fires RemoteEvent(EquipPet) – > Server Clones the Pet Model(Wherever I shall put it) and parents it to the player’s HRP.
I know that this post is a bit vague but I don’t know how to explain further. If you have questions to what I mean, ask! Hopefully I can answer them.
But i think the player should press the equip button on a gui (so a localscript to activate it)
Then an event fires that will tell the server script to put the pet inside the player and maybe weld it to the humanoidrootpart?
This (or a mutation of this) question has been asked several times and you should check out those threads. They have lots of information already discussed that is certainly valuable.
I’m sorry, but none of the posts have really helped me. Most of them only dealt with the movement system, while I need help with the structure of the whole system. The fifth one had nothing to do with scripting. The only post that describes to some extent what I want to achieve was too unclear and was therefore not solved.
For example I want to know where to put all my pet models, what to handle the pets with and how exactly the process is in a pet system. e.g. player presses ‘Equip’ button → remote event on the server is fired → pet model is cloned and parented to the player’s HRP.
It may well be that the flow I have given as an example is wrong. It was just an example.
A) Script the pet.
B) Make your button and set the parent to the PlayerGui by doing: button.Parent = player.PlayerGui (assuming you got the player from a remote event)
C) Make the script to clone the pet. (put it in replicatedstorage as it can be accessed from both the client and the server)
RemoteEvent.OnServerEvent:Connect(function()
local Pet = game:GetService("ReplicatedStorage").Pet
local ClonedPet = Pet:clone()
ClonedPet:MakeJoints()
ClonedPet.Parent = workspace
the above is just a basis for what your trying to do, if you want the pet to fly maybe set it as an adornee and use Udim2 values to get the offset above the player’s head.
Then look on youtube on how to script a follow system for the pet to follow the player assuming thats what you want to do.
But you can’t really get the full answer your looking for on the devforum, try asking for more detailed help on discord servers such as HD.
Youtube and google are the way to go!
The example you provided seems to be on the right path.
After a player clicks the button to equip the pet (assuming it’s from a GUI, and a local script. If so, it should be stored in StarterGui), it should fire a remote event (stored in ReplicatedStorage), and you’d need a server script (stored in ServerScriptService) listening to that same remote event. As for models, you might want to put them in ServerStorage as, per my understanding, only the server needs to access it. Then, after the pet is put into Workspace, I assume it’d have its own code inside the model, and it would run from there on.
If you need some definitions for these terms:
StarterGui: This is where you put all of the GUIs that the player should spawn with. Every time a player’s character spawns or respawns, the GUIs put into StarterGui will be replicated to the player’s screen.
The client would perhaps want to access the pet for a client-side event that you don’t want other players to see (e.g in a LocalScript) like idk maybe the pet reloading if it bugs out, there’s no problem with putting it in ServerStorage. Just use Replicated if you feel the need to.