This is in Roblox Lua, by the way. The result is a block that doesn't change color once I touch it. This text is to add characters to my description that isn't code so I can post it.
local player = game.Players.LocalPlayer local part = Instance.new("Part") part.Parent = game.Workspace local maxRGBValue = 500 local minRGBValue = 0 local r = 0 local g = 0 local b = 0 part.Touched:Connect(function(hit) if hit.Parent == player then while true do while r + g + b < maxRGBValue do wait(.03) r = r + 1 g = g + 1 b = b + 1 part.Color = Color3.fromRGB(r,g,b) end while r + g + b > minRGBValue do wait(.03) r = r - 1 g = g - 1 b = b - 1 part.Color = Color3.fromRGB(r,g,b) end end end end)

2 comments
Could you fix your formatting on the code block please. I'd like to help but reading that is hurting my face.
LocalScript or Server Script? You can't use LocalPlayer in a Server Script. And check if hit.Parent is equal to player.Character. Not player