Intense game-wide lag when cloning rthro body parts

Let’s try something then. You used GetDescendants() on the Teleport function, can you try with GetChildren() to see if the lag is still here?

it still lags when i use getchildren

Alright, i have one last idea. Let’s try another thing, instead of this on the teleport function:

for _,parts in pairs(Player.Character:GetChildren()) do
	if parts:FindFirstChild("IsTransparent") then
		parts.Transparency = 1
	end	
end

try this:

spawn(function()
	for _,parts in pairs(Player.Character:GetChildren()) do
		if parts:FindFirstChild("IsTransparent") then
			parts.Transparency = 1
		end	
		task.wait()
	end
end)

this isnt actually needed in the script, this is when i used it in an older game of mine and had parts of the player that needed to stay invisible

then try to comment this out, it will be one loop away

i removed that after originally posting this thread

i also saw something which can maybe cause some lags:

tweenClient:FireAllClients({Clone, 0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, {Transparency = 1, Size = v.Size + Vector3.new(1, 1, 1)}})
tweenClient:FireAllClients({v, 0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, {Transparency = 1}})

for every parts which pass the if, you fire these 2. which mean alot of parts almost instantly for every character

yeah i found a lot of things like that.

I’ve decided im just going to rewrite the entire script, as most functions used are outdated and deprecated so that could be causing lag. I’ll rewrite it possibly tomorrow

Alright, let me know if you succeeded on fixing the lag

Fully rewriting it fixed my issues!

I found that i had a loop in there like 4 times that i only needed once, and that was creating lag as it cloned the player a lot and scanned through descendants whilst doing that, so i guess rthro just being built different from regular packages caused the lag?

anyway, thank you for trying to help!

1 Like

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