My first code in Roblox

Hello Developers I present My First Code that I make in roblox any comment tell me

The function of the code is to change the color of the block every 1 second

 local Part8 = game:GetService("Workspace")
local MaterialService = game:GetService("MaterialService")
local Part7 =game.Workspace.Part7


while true do

	Part7.BrickColor = BrickColor.new(0.7, 0.9, 0.9)
	wait(1)
	Part7.BrickColor = BrickColor.new(0.9, 0.4, 0.9)
	wait(1)
	Part7.BrickColor = BrickColor.new(0.4, 0.5, 0.4)
	wait(56)	
		


end
2 Likes

Note: As of your first script, it looks good! There are a few things I would change though…

Part7.BrickColor = BrickColor.new(0.4, 0.5, 0.4)
wait(56)

You wanna change the part every second, why is there a wait 56 seconds?

 local Part8 = game:GetService("Workspace")
local MaterialService = game:GetService("MaterialService")
local Part7 =game.Workspace.Part7

Let’s tidy this up into more simpler things. You had the right idea. Just remove the space and add a space between the equal sign like this:

local Part8 = game:GetService("Workspace")
local MaterialService = game:GetService("MaterialService")
local Part7 = game.Workspace.Part7
local Part8 = game:GetService("Workspace")
local MaterialService = game:GetService("MaterialService")

I don’t think you need this service for this action, nor Part8, but I think it’s just a snippet of code in your full script.

while true do
	Part7.BrickColor = BrickColor.new(0.7, 0.9, 0.9)
	wait(1)
	Part7.BrickColor = BrickColor.new(0.9, 0.4, 0.9)
	wait(1)
	Part7.BrickColor = BrickColor.new(0.4, 0.5, 0.4)
	wait(56)	
end

Remove the gaps so it’s simpler.

Everything else looks good!

4 Likes