My Part.Size Not == TextBox.Text

  1. What do you want to achieve? If i print In TextBox 2 or 3 then Part.Size == TextBox.Text

  2. What is the issue?

Video

---- Script

local TextLabelSize = workspace.MakingPart.SurfaceGui.TextBox.Text

for _, Child in pairs(workspace.Clikers:GetChildren() ) do
	Child.Click.MouseClick:Connect(function()
	    if Child.Name == "A" then
		local ModelingPart  =	Instance.new("Part", workspace.ModelingPar)
			ModelingPart.Size = Vector3.new(1,1,1)
			ModelingPart.CFrame = workspace.HarePart.CFrame + Vector3.new(0,1,0)
		elseif Child.Name == "B" then
			local Whare = workspace.ModelingPar
			local Steps Whare:GetChildren()
			for _, child in ipairs(workspace.ModelingPar:GetChildren()) do
				local NewValue = tonumber(TextLabelSize)
				child.Size = Vector3.new(NewValue,NewValue,NewValue)
			end
		
		end
	end)
end

1

  1. What solutions have you tried so far? I don’t no where i need fix this, in youtobe have nothing.
1 Like

Your problem is simply that you save the text of the Textbox in the TextLabelSize variable.

This means that the moment the LocalScript loads in, it saves the text of the Textbox, which would just be “” at the time. Since You try to tonumber the text, which is “”, so you’re just doing tonumber("") which returns nil.

Then you essentially set the part’s size to Vector3.new(nil, nil, nil) which results to the XYZ values being 0.001. This video proves so.

Solution is simple: Get the text of the Textbox in Line 13:

local NewValue = tonumber(TextLabelSize.Text)

and remove “.Text” in the TextLabelSize variable in lline 1:

local TextLabelSize = workspace.MakingPart.SurfaceGui.TextBox

Hello @voozy_v i just doing all what did you say and still Nill and i don’t no why

local TextLabelSize = workspace.MakingPart.SurfaceGui.TextBox

for _, Child in pairs(workspace.Clikers:GetChildren() ) do
	Child.Click.MouseClick:Connect(function()
	    if Child.Name == "A" then
		local ModelingPart  =	Instance.new("Part", workspace.ModelingPar)
			ModelingPart.Size = Vector3.new(1,1,1)
			ModelingPart.CFrame = workspace.HarePart.CFrame + Vector3.new(0,1,0)
		elseif Child.Name == "B" then
			local Whare = workspace.ModelingPar
			local Steps Whare:GetChildren()
			for _, child in ipairs(workspace.ModelingPar:GetChildren()) do
				local NewValue = tonumber(TextLabelSize.Text)
				print(NewValue)
				child.Size = Vector3.new(NewValue,NewValue,NewValue)
			end
		
		end
	end)
end

(and this not in localScript)

Hare

I don’t see why the script wouldn’t work. Are you pressing Enter on your keyboard after you input the number on the TextBox?

i just try with not enter, its not work.

I found out that you are changing the text on the client, which does not replicate to the server. You could try switching out the Script with a LocalScript, placed somewhere like StarterPlayerScripts, or use a RemoteEvent.

1 Like

How i can make in With Event? i just don’t no.

I made my own version of it, try it out.
Solution.rbxl (63.7 KB)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.