I am trying to make it change the color of the text that's on the surfacegui, everything else is fine but the color won't change, and it sucks that there is no error code because i can't fix it without an error
Code:
local board = game.Workspace:WaitForChild("Board") local scriptablepart = board:WaitForChild("Scriptable") local sgui = scriptablepart:WaitForChild("SurfaceGui") local homeworktext = sgui:WaitForChild("HomeworkTitle"):WaitForChild("Homework") local assignmenttext = sgui:WaitForChild("AssignmentTitle"):WaitForChild("Assignment") local notetext = sgui:WaitForChild("TeachersNoteTitle"):WaitForChild("Note") local editedtext = script.Parent:WaitForChild("EditedText") local writeonboard = script.Parent:WaitForChild("WriteOnBoard") local currentcolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("CurrentColor") local blackcolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Black") local bluecolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Blue") local yellowcolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Yellow") local redcolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Red") local greencolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Green") local color = "Black" local colorforcoding = "0,0,0" currentcolor.Text = "Current: "..color.." "..colorforcoding writeonboard.MouseButton1Click:connect(function() homeworktext.TextColor3 = Color3.fromRGB(colorforcoding) homeworktext.Text = editedtext.Text end) blackcolor.MouseButton1Click:connect(function() color = "Black" colorforcoding = "0,0,0" currentcolor.Text = "Current: "..color.." "..colorforcoding end) bluecolor.MouseButton1Click:connect(function() color = "Blue" colorforcoding = "0,0,255" currentcolor.Text = "Current: "..color.." "..colorforcoding end) yellowcolor.MouseButton1Click:connect(function() color = "Yellow" colorforcoding = "255,255,0" currentcolor.Text = "Current: "..color.." "..colorforcoding end) redcolor.MouseButton1Click:connect(function() color = "Red" colorforcoding = "255,0,0" currentcolor.Text = "Current: "..color.." "..colorforcoding end) greencolor.MouseButton1Click:connect(function() color = "Green" colorforcoding = "0,255,0" currentcolor.Text = "Current: "..color.." "..colorforcoding end)
Try this code:
local board = game.Workspace:WaitForChild("Board") local scriptablepart = board:WaitForChild("Scriptable") local sgui = scriptablepart:WaitForChild("SurfaceGui") local homeworktext = sgui:WaitForChild("HomeworkTitle"):WaitForChild("Homework") local assignmenttext = sgui:WaitForChild("AssignmentTitle"):WaitForChild("Assignment") local notetext = sgui:WaitForChild("TeachersNoteTitle"):WaitForChild("Note") local editedtext = script.Parent:WaitForChild("EditedText") local writeonboard = script.Parent:WaitForChild("WriteOnBoard") local currentcolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("CurrentColor") local blackcolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Black") local bluecolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Blue") local yellowcolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Yellow") local redcolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Red") local greencolor = script.Parent:WaitForChild("ColorsTitle"):WaitForChild("Green") local color = "Black" local colorforcoding = Color3.fromRGB(0,0,0) currentcolor.Text = "Current: "..color.." "..tostring(colorforcoding) writeonboard.MouseButton1Click:connect(function() homeworktext.TextColor3 = colorforcoding homeworktext.Text = editedtext.Text end) blackcolor.MouseButton1Click:connect(function() color = "Black" colorforcoding = Color3.fromRGB(0,0,0) currentcolor.Text = "Current: "..color.." "..tostring(colorforcoding) end) bluecolor.MouseButton1Click:connect(function() color = "Blue" colorforcoding = Color3.fromRGB(0,0,255) currentcolor.Text = "Current: "..color.." "..tostring(colorforcoding) end) yellowcolor.MouseButton1Click:connect(function() color = "Yellow" colorforcoding = Color3.fromRGB(255,255,0) currentcolor.Text = "Current: "..color.." "..tostring(colorforcoding) end) redcolor.MouseButton1Click:connect(function() color = "Red" colorforcoding = Color3.fromRGB(255,0,0) currentcolor.Text = "Current: "..color.." "..tostring(colorforcoding) end) greencolor.MouseButton1Click:connect(function() color = "Green" colorforcoding = Color3.fromRGB(0,255,0) currentcolor.Text = "Current: "..color.." "..tostring(colorforcoding) end)