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
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.
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
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.