I am making a Grass Color Setting where the player uses arrows to move back and forth through the table.
Code:(All help an advice is appreciated)
--<Tables & Dictionaries>--
local GrassColors = {
Color3.fromRGB(75, 100, 41),
Color3.fromRGB(50, 66, 29),
Color3.fromRGB(50, 96, 37),
Color3.fromRGB(89, 95, 47)
}
--<Scripts>--
--Grass Colors
local nextBtn = GrassColor.next
local backBtn = GrassColor.back
local TextLabel = GrassColor.TextLabel
local currcolor = 1
local max = #GrassColors
local min = 1
local Terrain = workspace.Terrain
nextBtn.MouseButton1Click:Connect(function()
if currcolor < max and currcolor >= min then
currcolor += 1
Terrain:SetMaterialColor(GrassColors[currcolor])
TextLabel.Text = "Color "..tostring(currcolor)
end
end)
backBtn.MouseButton1Click:Connect(function()
if currcolor < min and currcolor <= max then
currcolor -= 1
Terrain:SetMaterialColor(GrassColors[currcolor])
TextLabel.Text = "Color "..tostring(currcolor)
end
end)