Instance children are nil in client but not in server while sending instance through remote event

Hi,
This is my server-side script(Module script) and here, the Target(Instance) name and children are printed correctly:

function UnitModule.Attack(Unit,player)
		local attributs = Unit:GetAttributes()
		local target = UnitModule.FindTarget(Unit,attributs.Range,attributs.TargetMode)
		if target and target.Humanoid.Health >= 0 then
		local Damage = math.clamp(target.Humanoid.Health,0,attributs.Damage)
			Unit.HumanoidRootPart.BodyGyro.CFrame =  CFrame.new(Unit.PrimaryPart.Position,target:WaitForChild("HumanoidRootPart").Position)
			Unit.TotalDamage.Value += Damage
			print(target.Name) --prints target's name
            rs.Events.Animator:FireAllClients(Unit,"Attack",target) -- the event that causes problem
            print(target:GetChildren()) -- prints a table of children

and this is the local script that connects the event to a function:

Events.Animator.OnClientEvent:Connect(function(Char,Anim,Target)
	PlayAnimation(Char,Anim)
	if Target then
		print(Target.Name) --prints target's name correctly
        print(Target:GetChildren()) --prints an empty table D:
        FireProjectile(Char,Target) 
	end 
end)

I tried looking devforum but I only found things like don’t pass player as first argument, add some wait statement to load the instance and other stuff that I already tried :cry:

sorry if this is a confusing explanation of this problem, had many modules and local scripts connecting to each other so it will be a long post to explain each variable and functions.

any help would be greatly appreciated c:

are you sure target is also on the client and it’s not an object that only the server can access like something inside of ServerStorage?
Because sending an instance that’s not present on the client will return nil
https://create.roblox.com/docs/scripting/events/remote#non-replicated-instances

Now i am not sure if this could be because of StreamingEnabled that the part is not replicated to the client causing it to return nil.

Yes it surely is visible and accessible to client because it’s parent is a folder of workspace and as a said:

It prints the target name but prints its children as an empty table somhow ;-; …

nope it isnt.

Also I can make it work though some tricks like passing target name as parameter instead of whole instance and searching the workspace folder that the target instance is parented with but I just wanna know what’s the main problem that is causing this. I probaly didn’t provided enough information so let me know if i’m missing somethin.

So the issue has nothing to do with the remote event.
The only thing i can think of is still streaming enabled.
Can you test it quickly by disabling StreamingEnabled and test it again?
Otherwise i’d have no idea

Just tested it but still exact same result, and yes I double checked the steaming enabled properpty its disabled as expected.

bump, I still really need help :cry:. Here’s an output of what both scripts print for more info:
BUG :C

zombie is the name of the target instance.

Appearantly, I had a constant loop running for checking that if target’s health is 0 then create some visual effects and because there were many targets and it was a constant loop it was disturbing that remote instance, after removing that loop it’s working fine. Pretty dumb problem and obvs fix. TY @Brambes230605 for your help and sorry for any inconvenience. :heart:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.