I’m making a windows xp game and the changing colour of the dot isn’t working when I add the new line of code it works but it don’t work with colour it all I have made a previous post before days back but I didn’t get a strong answer.
Code:
local frame = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
local ClearButton = script.Parent.ClearButton
game:GetService(“RunService”).RenderStepped:Connect(function()
x = mouse.X
y = mouse.Y
if pressed == true then
local dot = Instance.new(“Frame”)
dot.Name = “Dot”
dot.Parent = frame
dot.BackgroundColor3 = Color3.new(0,0,0)
dot.Size = UDim2.new(0, 6, 0, 6)
dot.Position = UDim2.new(0, x - frame.AbsolutePosition.X, 0, y - frame.AbsolutePosition.Y)
end
end)
ClearButton.MouseButton1Click:Connect(function()
for i, q in pairs(frame:GetChildren()) do
if q.Name == “Dot” then
q:Destroy()
end
end
end)
color = Color3.fromRGB(0, 0, 0)
dot.BackgroundColor3 = color
RedButton.MouseButton1Click:Connect(function()
color = Color3.fromRGB(0, 0, 0)
local color = Color3.fromRGB(255, 0, 0)
end)
I have reviewed the code over and over again and nothing
Output Says:
Players.3DRobloxGameDev.PlayerGui.Options.Startup.frame.LocalScript:39: attempt to index nil with ‘BackgroundColor3’
color = Color3.fromRGB(0, 0, 0)
local.dot = color
RedButton.MouseButton1Click:Connect(function()
color = Color3.fromRGB(0, 0, 0)
local color = Color3.fromRGB(255, 0, 0)
end)
local frame = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()
local ClearButton = script.Parent.ClearButton
local dot -- <-- here
local x
local y
local pressed = false
mouse.Button1Down:Connect(function()
pressed = true
end)
mouse.Button1Up:Connect(function()
pressed = false
end)
game:GetService("RunService").RenderStepped:Connect(function()
x = mouse.X
y = mouse.Y
if pressed == true then
dot = Instance.new("Frame") -- <--here
dot.Name = "Dot"
dot.Parent = frame
dot.BackgroundColor3 = Color3.new(0,0,0)
dot.Size = UDim2.new(0, 6, 0, 6)
dot.Position = UDim2.new(0, x - frame.AbsolutePosition.X, 0, y - frame.AbsolutePosition.Y)
end
end)
ClearButton.MouseButton1Click:Connect(function()
for i, q in pairs(frame:GetChildren()) do
if q.Name == "Dot" then
q:Destroy()
end
end
end)
RedButton.MouseButton1Click:Connect(function()
dot.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- <here
end)
That is so weird its acting like nothing is wrong with it in the output but don’t change colour i also appreciate you for helping me as I am a weak coder!
We have some progress I made some colour on adding more references but it dont colour it how i wanted it only colours it like 1 part that was recently done not an entire thing for colour
You will do the same as in the function where you delete dot just instead of deleting you will paint.
RedButton.MouseButton1Click:Connect(function()
for i, q in pairs(frame:GetChildren()) do
if q.Name == "Dot" then
q.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
end
end
end)
You will add new value on top local dotColor = Color3.fromRGB(0,0,0) its default color.
In function with runservice make dot.BackgroundColor3 = dotColor and in last function under q.BackgroundColor3 =… add dotColor = q.BackgroundColor3
Well so basically if I don’t describe myself right ill have a picture up so when you go click for instance red it changes the part to red then you click blue and it keeps the other red but makes the new blue.