Need help on simultaneously tweening part colors

Trying to get an NPC’s bodyparts to tween to a different color at the same time, need help because I’m having trouble on how to reference the color values to change them

tried pairs and ipairs, tried going for different methods like bodyparts[i].Color etc etc

local event = game:GetService("ReplicatedStorage"):WaitForChild("Trigger")
local object = script.Parent 
local tween = game:GetService("TweenService")

local bodyparts = {object.LeftFoot, object.LeftHand, object.LeftLowerArm, object.LeftLowerLeg, object.LeftUpperArm, object.LeftUpperLeg, 
	object.LowerTorso, object.RightFoot, object.RightHand, object.RightLowerArm, object.RightLowerLeg, object.RightUpperArm, object.RightUpperLeg,
	object.UpperTorso, object.Head
}
function changecolor(color)
	object.Name = "NetFinch"
	local goal = {Color = Color3.new(0.333333, 0, 0)}
	for i,v in ipairs(bodyparts) do
		tween:Create(bodyparts[i], TweenInfo.new(3), goal)
	end
end


event.OnServerEvent:Connect(changecolor)

any help is appreciated

You should :Play() the tween
–this text exists because devforum needs more characters minimum.

I was going to get to that eventually but my focus right now is removing the errors I’m getting for the tween creation

edit: hold on let me do another double check

looks like I was jumping to conclusions too early and didn’t realize my latest change (bodyparts[i]) was actually proper and ended up confusing myself thinking the error report that didn’t pop up was a no error bug (I’ve had the same issue in the pas for other projects) that I needed a workaround for, thanks

for any new scripters learning tweenservice and is using this post for help/reuse on coding at any point, remember that creating a variable for the tween creation instead of the tweenservice (or in this case the variable called tween) is needed to play the tween itself

e.g.
instead of this

tween:Create(bodyparts[i], TweenInfo.new(3), goal)
tween:Play()

use this

local tweencreation = tween:Create(bodyparts[i], TweenInfo.new(3), goal)
		tweencreation:Play()

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