Client isn't able to received replicated parts from server?

On the server, I spawn in fruits like apples, bananas, plums etc you get it. I would like to animate these objects on the client to make things more smooth and less laggy. So I’ve made my setup:

--|| SERVICES ||--
local TweenService = game:GetService("TweenService")

--|| LOCAL ||--
local Pairs = pairs
local Script = script

--|| VARIABLES ||--
local Range = 5 -- Studs
local Drops = {}

--|| FUNCTIONS ||--
local function animateDrop(Drop)
	TweenService:Create(Drop.Core, TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, -1), {["CFrame"] = Drop.Core.CFrame*CFrame.fromEulerAnglesXYZ(0,360,0)}):Play()
	TweenService:Create(Drop.Core, TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, -1, true), {["CFrame"] = Drop.Core.CFrame*CFrame.new(0,3,0)}):Play()
end

-- Managing Drops
for _, Drop in Pairs(game.Workspace.World.Drops:GetChildren()) do
	animateDrop(Drop)
end

game.Workspace.World.Drops.ChildAdded:Connect(function(Drop)
	animateDrop(Drop)
end)

return Drops

But then I noticed something:

Now obviously I thought I forgot to set the PrimaryPart but then I noticed that the primary parts exist:

Attempting to print any children in the fruits will return nil or error. I then proceeded to iterate through the model and still nothing. I made sure StreamingEnabled was set to false and well, it was.

So now I’m stuck no idea why the Client is unable to see the parts but like I was on the client view and I was seeing the fruits with the models.

So what is the issue? How should I resolve something like this?

That is very weird.

It might be due to the client receiving the model instance before it receives any of the parts inside of it. So when the model is added, the animation tries to fire right away.

To fix this try to wait and check if the Core part exists before trying to animate.

2 Likes