Using Color.fromHex() does work just replace the value in colorchosen with Color3.fromhex(your hex code here)
i put the code in sever script right?
for i, Button in pairs(colorButtons:GetChildren()) do
if Button:IsA("TextButton") then
Button.MouseButton1Click:Connect(function()
colorchosen = Button.Value.Value
end)
end
end
since you havent named each value to be âButtonColorâ, use this version instead
oh thank you, i didnt see that
here, a video
sorry for bad quality
that happened with the code i altered for you?
yes, even before the altered code, still the same
could you post your entire code so far? im not sure how it looks right now
sure,
local partsFolder = workspace:WaitForChild("Parts")
local colorButtons = game.StarterGui.ScreenGui.Frame
local colorchosen = Color3.fromRGB(0, 0, 0)
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()
changePartColor(part)
end)
end
end
for i, Button in pairs(colorButtons:GetChildren()) do
if Button:IsA("TextButton") then
Button.MouseButton1Click:Connect(function()
colorchosen = Button.Value.Value
end)
end
end
i never thought my first game would be so challenging
Correct me if Iâm wrong, but canât you just use the background color of the button?
i think i might know what happened
local colorButtons = game.StarterGui.ScreenGui.Frame
here you need to reference the PlayerGui
not the StarterGui
. Is this game single player? if so its more straight forward to do and you can use:
local Player = game.Players.ChildAdded:Wait()
local partsFolder = workspace:WaitForChild("Parts")
local colorButtons = game.StarterGui.ScreenGui.Frame
local colorchosen = Color3.fromRGB(0, 0, 0)
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()
changePartColor(part)
end)
end
end
for i, Button in pairs(colorButtons:GetChildren()) do
if Button:IsA("TextButton") then
Button.MouseButton1Click:Connect(function()
colorchosen = Button.Value.Value
end)
end
end
its not single player
the 30 minimum thing is bad
game.Players.PlayerAdded:Connect(function(Player)
local partsFolder = workspace:WaitForChild("Parts")
local colorButtons = Player.PlayerGui.ScreenGui.Frame
local colorchosen = Color3.fromRGB(0, 0, 0)
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()
changePartColor(part)
end)
end
end
for i, Button in pairs(colorButtons:GetChildren()) do
if Button:IsA("TextButton") then
Button.MouseButton1Click:Connect(function()
colorchosen = Button.Value.Value
end)
end
end
end)
altered it for multiplayer try it out
error: 23:50:13.000 ScreenGui is not a valid member of PlayerGui âPlayers.pontzo_tzoz.PlayerGuiâ - Server - Script:4
You canât detect TextButton clicks from the server
can you show me the children of your player in players?
oh well , i have to go to bed (3030303030)
hold on a sec ive got it
\\\\