for i,v in pairs(workspace:GetDescendants()) do if v:IsA("Part") and v.Parent.Name == "WindBrine" or v:IsA("Part") and v.Parent.Name == "WindBrianne" then game:GetService("TweenService"):Create(v, TweenInfo.new(1), {Color = Color3.fromRGB(255,255,255)}):Play() end end
I am using a simple for loop to tween the body part colours of 2 players ingame towards a similar color.
However if this is done at the same time on multiple players the clothes start to glitch out like so:
I tried doing this through both client and server, but nothing seems to work.
I wish to know if there is a way around this or a better way to handle smoothly changing part colour which does not cause this issue.
This ONLY happens when tweening more than 1 player a the same time. Also seems to overlay the face decal aswell.
First of all, I don’t recommend looping through the workspace using GetDescendants(). Instead use this,
for i,Player in pairs(game.Players:GetPlayers()) do
if not Player.Character then continue end
local Character = Player.Character
for i, BodyPart in pairs(Character:GetDescendants()) do
if not v:IsA("Part") then continue end
--Insert rest of code
end
end
So, it seems that in every Player Character, there is an instance called Body Colors that you can use to change the color of body parts. Try to tween these properties.
I don’t see anything strikingly wrong with your script. Like @striker2783 mentioned, you could certainly handle this more efficiently, but tweening the colors of parts should not constitute a dramatic clothing change. Could you show us more of the script?
Sorry for being late, but that is quite literally all of the script. The one I included in the original post causes the exact same results as the one I am primarily using, the only difference being is that all body parts are originally predefined instead of checking them through a loop. (Character.Head, Character[“Right Arm”] etc).
local HT = TweenService:Create(Character["Body Colors"], TweenInfo.new(3), {HeadColor3 = Color3.new(1, 1, 1)}) HT:Play()
example from the main script where i tried it with body colors.