Hi! I want to make an animated float system for pets, like a bubble one, smooth and nice.
This is how it stays close to me, server-sided:
while wait() do
local vector3 = game.ServerStorage.Pets.Pos[script.Pos.Value].Value
local pos = player.Character.HumanoidRootPart.CFrame * CFrame.new(vector3)
bodygyro.CFrame = player.Character.HumanoidRootPart.CFrame
bodyposition.Position = Vector3.new(pos.x, pos.y, pos.z)
end
So I use BodyGyro and BodyPos and I don’t know if I need some localsided renderstepped floating, or use tweens, or Animations.
Neither of those ways worked well or not at all. This is the closest I have:
I would recommend you to use BodyPosition and BodyGyros in the client side, because otherwise the server can have performance issues, also you should use RenderStepped, as the while loop isn’t really ideal for it.
I suppose having a loop that is changing the y axis constantly with ±0.01 would be the easiest way. You could just make a variable and loop through it. When it becomes 1, just make it subtract til it reaches 0 and vice versa. Then just add it to the y axis. That should be the easiest way (Not sure if it’s the cleanest way though)
Ok got it. What you say is for my pets, but how should I do with other people’s pets? I need like one script with one renderstepped for each pet in the game, or just one renderstepped with a for loop to do it with all the pets?
What I mean actually is each clients pets are handled by them, in the client side scripts. And yes all pets of that player in one RenderStepped should work.