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