Hey guys, so I’m making a co-op game where there is a baby and an adult. I want to have it so the adult had a baby carrier on their back so the baby can ride on their back. So I have a few questions regarding the process of making this.
1: How do I make it so when the players enter the game, a baby carrier (which I can make) is automatically given to the adult?
2: How do I make it so the baby can go up to said carrier and toggle a proximity prompt to ride on the back? How do I make it so only the baby that is partnered with the adult can toggle it?
The reason I need help here is cus Idk how to do weld stuff (which I assume u need for attaching the carrier to the adult) and also how to use proximity prompts cus the never seem to work for me (I am dumb)
Thank you!
Running code when a player enters a game:
<https://create.roblox.com/docs/reference/engine/classes/Players#PlayerAdded
Proximity prompts:
https://create.roblox.com/docs/ui/proximity-prompts
https://create.roblox.com/docs/reference/engine/classes/ProximityPrompt#Triggered
You haven’t provided insight into how the adult/baby pairing works. The most convenient way to associate a baby with an adult is to place an ObjectValue in the adult’s Player
instance. You can then write the baby’s Player
instance to the ObjectValue
’s “Value” property. This creates an instance reference. The ProximityPrompt
will read that instance reference and compare it to the player who triggered the prompt.
Welding:
https://create.roblox.com/docs/reference/engine/classes/WeldConstraint
You will most likely have a Model
. You’ll need to weld each part to a root-part within the Model
. Weld the root-part to the player’s “HumanoidRootPart”.
Part0
is the part you’re welding.
Part1
is the part you’re welding to.
Set the CFrame
of the Model
via Model:PivotTo and Model:GetPivot. Once it’s in place, weld the root-part, then set the Model
’s parent accordingly.
Most of these systems will be implemented on the server via Script
s. Be sure to respect the client-server model
For attaching the baby to the carrier, should I weld the baby to the carrier and detach it? Or should I use another method?
This is a little harder to say. You would be welding the baby to the carrier, but the baby has its network ownership assigned to the client controlling the baby. This leads to a physics conflict that would introduce latency into the adult’s inputs when the baby gets welded to the adult. You might be able to relinquish the network ownership of the baby’s character to the client of the adult, but this could pose a security concern as an exploiter with ownership over the baby’s character could distort the character or cause death to the other player.
Some recent experimentation shows that despite having network ownership over welded parts, changes in its position were not replicated, but that might be due to a client-sided denial that an exploiter could override. Maybe someone else can support or deny this potentiality with certainty.
The next best bet would be to copy the baby’s character and have the client of the baby switch its camera to that clone, as well as forward chat bubble to that clone. Until then, I recommend trying out the first approach
Would just having it as a piggy back be any better, like the baby rides on their shoulder?
The issue is welding a non-owned part to a part in the player’s character. It would just be the same thing