WhiteBoard Sizing Issue

Im making a whiteboard Gui and have an issue with making the dot bigger in size so when you press once it sizes it by 1 or so bigger
The issue is i cant find something that i want or without it breaking my code

Code:

--Service local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse()

--Gui local frame = script.Parent local ClearButton = script.Parent:WaitForChild("ClearButton")

--Value local dotColor = Color3.new(0,0,0) local pressed = false local x,y,dot

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") dot.Name = "Dot" dot.BorderSizePixel = 0 dot.Parent = frame dot.BackgroundColor3 = dotColor 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)

for number,buttons in pairs(frame:GetChildren()) do --get all things if buttons:IsA("TextButton") and buttons:GetAttribute("dotColor") then -- filter buttons with attribute named dotcolor buttons.MouseButton1Up:Connect(function() dotColor = buttons:GetAttribute("dotColor") --change dotcolor to color in attribute end) end end

MoreSize.MouseButton1Click:Connect(function() for i, q in pairs(frame:GetChildren()) do dot.Name = "Dot" dot.BorderSizePixel = 0 dot.Parent = frame dot.BackgroundColor3 = dotColor dot.Size = UDim2.new(0, 9, 0, 6) dot.Position = UDim2.new(0, x - frame.AbsolutePosition.X, 0, y - frame.AbsolutePosition.Y) end)

Im not the best coder im slowly learning and tried for a bit

It would be helpful to format your code:

--Service 
local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse()

--Gui local 
frame = script.Parent 
local ClearButton = script.Parent:WaitForChild("ClearButton")

--Value 
local dotColor = Color3.new(0,0,0) 
local pressed = false 
local x,y,dot

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") 
		dot.Name = "Dot" 
		dot.BorderSizePixel = 0 
		dot.Parent = frame 
		dot.BackgroundColor3 = dotColor 
		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)

for number,buttons in pairs(frame:GetChildren()) do 
	--get all things 
	if buttons:IsA("TextButton") and buttons:GetAttribute("dotColor") then 
		-- filter buttons with attribute named dotcolor 
		buttons.MouseButton1Up:Connect(function() dotColor = buttons:GetAttribute("dotColor") --change dotcolor to color in attribute 
			
		end) 
	end 
end

MoreSize.MouseButton1Click:Connect(function() 
	for i, q in pairs(frame:GetChildren()) do 
		dot.Name = "Dot" 
		dot.BorderSizePixel = 0 
		dot.Parent = frame 
		dot.BackgroundColor3 = dotColor 
		dot.Size = UDim2.new(0, 9, 0, 6) 
		dot.Position = UDim2.new(0, x - frame.AbsolutePosition.X, 0, y - frame.AbsolutePosition.Y) 
	end
end)

I’m not really sure what you are trying to do. Are you trying to place a dot on a gui that you can increase in size?

Yes I am and Im so confused on making your code neat On here sometimes i get people saying the one you said or the one I said i get confused on that

when you submit your code just wrap it in three "" at the start and finish. I don't know how to escape the tick mark so I can't type it here. Its just three of this char: 96 60 01100000 ` ← three of these at the start of code and three at the end of code

I think i get it, you are trying to draw on a white frame by holding the mouse button down, right?

Similar clicking on a button to increase the size by 1

Ok, here is a fix for the sizing issue:

print("Hello world!")

wait(3)
--Service 
local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse()

--Gui local 
frame = script.Parent 
local ClearButton = script.Parent:WaitForChild("ClearButton")
local MoreSize = script.Parent:WaitForChild("MoreSize")
--Value 
local dotColor = Color3.new(0.666667, 0, 0)
local pressed = false 
local x:number,y:number,dot:Frame

mouse.Button1Down:Connect(function() pressed = true end)

mouse.Button1Up:Connect(function() pressed = false end)
local dotSize = UDim2.new(0, 6, 0, 6) 
game:GetService("RunService").RenderStepped:Connect(function() 
	x = mouse.X 
	y = mouse.Y 
	if pressed == true then 
		warn("running...")
		dot = Instance.new("Frame") 
		dot.Name = "Dot" 
		dot.BorderSizePixel = 0 
		dot.Parent = frame 
		dot.BackgroundColor3 = dotColor 
		dot.Size = dotSize
		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)

--for number,buttons in pairs(frame:GetChildren()) do 
--	--get all things 
--	if buttons:IsA("TextButton") and buttons:GetAttribute("dotColor") then 
--		-- filter buttons with attribute named dotcolor 
--		buttons.MouseButton1Up:Connect(function() 
--			dotColor = buttons:GetAttribute("dotColor") 
--			--change dotcolor to color in attribute 
			
--		end) 
--	end 
--end

MoreSize.MouseButton1Click:Connect(function() 
	for i, q in pairs(frame:GetChildren()) do 
		if q:isA("Frame")  and q.Name == "Dot" then 
			q.BackgroundColor3 = dotColor 
			q.Size = q.Size + UDim2.new(0, 1, 0, 1) 
			dotSize = q.Size
		end
	end
end)

On the MoreSize button you have to update the existing frames with the new size only. And
make sure any new frames use the same size, in this case (dotSize)

The dots don’t seem to follow the mouse though. I still have to look at that. Unless you are satisfied
with this answer.

Thats an interesting way to do it is their a way to make it so you do one for ect you draw 1 and it stays the same size and you size the one your gonna do and it makes that 1 bigger

Yes, I assumed you wanted to update all the old dots. Just add another button and only change dotSize
and leave the existing frames alone. You want the code?

So yeah bassicaly it only updates a new dot thats gonna be drawn is their something in the properties i need to change because I dont get exactly what your saying if its with code yes please.

print("Hello world!")

wait(3)
--Service 
local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse()

--Gui local 
frame = script.Parent 
local ClearButton:TextButton = script.Parent:WaitForChild("ClearButton")
local MoreSize:TextButton = script.Parent:WaitForChild("MoreSize")
local SizeNew:TextButton = script.Parent:WaitForChild("SizeNew")
--Value 
local dotColor = Color3.new(0.666667, 0, 0)
local pressed = false 
local x:number,y:number,dot:Frame

mouse.Button1Down:Connect(function() pressed = true end)

mouse.Button1Up:Connect(function() pressed = false end)
local dotSize = UDim2.new(0, 6, 0, 6) 
game:GetService("RunService").RenderStepped:Connect(function() 
	x = mouse.X 
	y = mouse.Y 
	if pressed == true then 
		warn("running...")
		dot = Instance.new("Frame") 
		dot.Name = "Dot" 
		dot.BorderSizePixel = 0 
		dot.Parent = frame 
		dot.BackgroundColor3 = dotColor 
		dot.Size = dotSize
		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)

--for number,buttons in pairs(frame:GetChildren()) do 
--	--get all things 
--	if buttons:IsA("TextButton") and buttons:GetAttribute("dotColor") then 
--		-- filter buttons with attribute named dotcolor 
--		buttons.MouseButton1Up:Connect(function() 
--			dotColor = buttons:GetAttribute("dotColor") 
--			--change dotcolor to color in attribute 
			
--		end) 
--	end 
--end

MoreSize.MouseButton1Click:Connect(function() 
	for i, q in pairs(frame:GetChildren()) do 
		if q:isA("Frame")  and q.Name == "Dot" then 
			q.BackgroundColor3 = dotColor 
			q.Size = q.Size + UDim2.new(0, 1, 0, 1) 
			dotSize = q.Size
		end
	end
end)

SizeNew.MouseButton1Click:Connect(function()
	dotSize = dotSize + UDim2.new(0, 1, 0, 1) 
end)

This broke it the output says this in orange text:

Infinite yield possible on 'Players.3DRobloxGameDev.PlayerGui.Options.Startup.Paint:WaitForChild(“SizeNew”)

you need to add a textbutton named “SizeNew”

Same orange text after changing the name of it

Infinite yield possible on 'Players.3DRobloxGameDev.PlayerGui.Options.Startup.Paint:WaitForChild(“MoreSize”)

I just added ANOTHER textbutton, didn’t rename the existing one. So a total of three buttons.

Thank you how would I make it do decrease?

Add another button to make it smaller say “SizeSmaller” and subtract one from the size :

SizeSmaller.MouseButton1Click:Connect(function()
	dotSize = dotSize - UDim2.new(0, 1, 0, 1) 
end)

Output:

Players.3DRobloxGameDev.PlayerGui.Options.Startup.Paint.LocalScript:68: attempt to index nil with 'MouseButton1Click’Players.3DRobloxGameDev.PlayerGui.Options.Startup.Paint.LocalScript:68: attempt to index nil with ‘MouseButton1Click’

Do i have to do anything with the upper of the code