(keep in mind that i am very new to programming i started like 2 days ago so i may not understand very basic things) so basically, im trying to make a game where you can draw (my first game), but the color is not working
-
What do you want to achieve? Keep it simple and clear!
i want it to make it so that when a player clicks a color, the player can draw with that -
What is the issue? Include screenshots / videos if possible!
the color just doesnt work, sets to black instead -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i did look on the developer forum, but there was nothing
ive tried this so far (current version):
(regular script in server script service)
local partsFolder = workspace:WaitForChild("Parts")
local colorButtons = game.StarterGui.ScreenGui.Frame
local colorchosen = "#000000"
-- sorry if this next bit is too unoptimized, i dont know much
if colorButtons.Red.Activated then
colorchosen = "#FF0000"
print(colorchosen)
elseif colorButtons.Orange.Activated then
colorchosen = "#FF5F14"
print(colorchosen)
elseif colorButtons.Yellow.Activated then
colorchosen = "#FFE600"
print(colorchosen)
elseif colorButtons.Green.Activated then
colorchosen = "#45DB00"
print(colorchosen)
elseif colorButtons.LightBlue.Activated then
colorchosen = "#00FFE1"
print(colorchosen)
elseif colorButtons.Blue.Activated then
colorchosen = "#008CFF"
print(colorchosen)
elseif colorButtons.Pink.Activated then
colorchosen = "#FF00FF"
print(colorchosen)
elseif colorButtons.Purple.Activated then
colorchosen = "#BF00FF"
print(colorchosen)
elseif colorButtons.White.Activated then
colorchosen = "#FFFFFF"
print(colorchosen)
elseif colorButtons.Black.Activated then
colorchosen = "#000000"
print(colorchosen)
end
local function changePartColor(part)
print("Changing color of part:", part.Name, "to color:", colorchosen)
part.Color = Color3.new(colorchosen)
print("New color of part:", part.Name, "is:", part.Color)
end
for _, part in ipairs(partsFolder:GetChildren()) do
if part:IsA("BasePart") then
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part
clickDetector.MouseClick:Connect(function(player)
changePartColor(part)
end)
end
end
and this:
(regular script in the color text buttons)
local button = script.Parent
local function colorchange()
colorchosen = "(the hex value here)"
end
button.MouseButton1Click:Connect(colorchange())
-- also in the other script in this version is basically the same but without the long bit