I would like to ask for a little help.
I wanted to make a Light, that goes from Green To red, and then back to green when touched. I want it to be smooth but I can't really figure out how TweenService works, so I would be glad if someone could help me. Any help is appreciated and I hope someone can help with my question!
This is an edit of @JesseSong 's answer since I tried it and it doesn't work. This would work:
local part = script.Parent part.Touched:Connect(function(hit) local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) if player then local ts = game:GetService("TweenService") local tween = TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out) local t = ts:Create(part, tween, {Color = Color3.fromRGB(1,255,255)}) t:Play() end end)
The below code should work you may need to edit some stuff in studio. And there is no such thing as color tweening
part.Touched:Connect(function(hit) local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) if player then local part = script.Parent local ts = game:GetService('TweenService') local tween = TweenInfo.new(1, 'Bounce', 'Out') local t = ts:Create(part, tween, {BackgroundColor3 = Color3.new(1,255,255)}) t:Play() end end)
If I helped you make sure to accept this answer