Tween not tweening

I’m trying to change the color of a part in a folder in workspace, but it doesn’t seem to work properly?
After creating the tween the script seems to just stop for some reason. Please help.

This is not the entire script and I made sure that TweenService is defined as game:GetService(“TweenService”). I tried also just using the part without indexing CFrame but didn’t work either.

	local class = rockFriend.ClassName
	local color = rockFriend.Color
	local goal = {}
	goal.setcolorRGB = Color3.fromRGB(190,20,20)
	local tweenInfo = TweenInfo.new(20)
	print(rockFriend.Color, rockFriend.CFrame)
	print(class)
	local tweencolor = TweenService:Create(rockFriend.CFrame,tweenInfo,goal)
	print("tween play")
	tweencolor:Play()

First two prints print. RockFriend is a part. “tween play” doesn’t print anymore.

1 Like

The reason why it’s not playing is the Goal needs to be the specific property of the part you’re tweening. Instead of goal.setcolorRPG you would want to to be goal.Color

This is seen from the example taken from TweenService | Documentation - Roblox Creator Hub

local TweenService = game:GetService("TweenService")

local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Color = Color3.new(1, 0, 0)
part.Anchored = true
part.Parent = game.Workspace

local goal = {}
goal.Position = Vector3.new(10, 10, 0) --This can also work with CFrame
goal.Color = Color3.new(0, 1, 0) --Emphasis on the .Color as I described above

local tweenInfo = TweenInfo.new(5)

local tween = TweenService:Create(part, tweenInfo, goal)

tween:Play()
2 Likes

Have you been getting any errors?
setcolorRGB is not a part’s property as far as i’m aware. Try changing it with “Color”

1 Like

No errors, also changing it with “Color” doesn’t change anything sadly.

local class = rockFriend.ClassName
	local color = rockFriend.Color
	local goal = {}
	goal.setcolorRGB = Color3.fromRGB(190,20,20)
	local tweenInfo = TweenInfo.new(20)
	print(rockFriend.Color, rockFriend.CFrame)
	print(class)
	local tweencolor = TweenService:Create(rockFriend.CFrame,tweenInfo,goal)
	print("tween play")
	tweencolor:Play()

why do you say rockFriend.CFrame in the tween? just asking.

1 Like

TweenService:Create() should have a part as 1st argument. Try replacing your line with this

local tweencolor = TweenService:Create(rockFriend,tweenInfo,goal)

I was just testing how i would change it, I don’t quite know myself :sweat_smile:

maybe try:

local class = rockFriend.ClassName
	local color = rockFriend.Color
	local goal = {}
	goal.setcolorRGB = Color3.fromRGB(190,20,20)
	local tweenInfo = TweenInfo.new(20)
	print(rockFriend.Color, rockFriend.CFrame)
	print(class)
	local tweencolor = TweenService:Create(rockFriend,tweenInfo,{Color = goal.setcolorRGB})
	print("tween play")
	tweencolor:Play()
1 Like

Thanks it’s working now. Silly me

No problem! Im glad i could help!

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