Setting Vector3 to text from a textbox

so what i am trying to do is a gui properties tab but the Vector3 stuff is not working. If i try to set the size of a part to 3, 2, 5 it will just be set to 0.005, 0.005, 0.005

Client

local event = game:GetService("ReplicatedStorage"):FindFirstChild(plrN.."'s action")
event:FireServer("SetPropertie",part,v.Name,v.Text)

Server

remote.OnServerEvent:Connect(function(plr,action,v1,v2,v3)

--[[
v1 is the part
v2 is the Name the client sent
v3 is v.Text the client sent which is what i want to set the size to. The text is a Vector3 for example 
4, 1, 2
]]--

if action == "SetPropertie" and v1 ~= nil then
	if v2 == "size" then
		v1.Size = Vector3.new(v3)
	end
end

end)

what i think the problem could be is that when i set it to Vector3.new(v3) it just sets the X axi, but there is no errors like argument #3 missing or nil.

so if u have a solution i would really appreciate it if u could help.

You could try splitting the string by using string.split() then setting the separator to be “,”

This would return a table where you could just put each value into a Vector3.new()
You would also need to convert the values to numbers using tonumber()

Example Code:

local exampleString = "1, 2, 3"

local tonum = tonumber

local separated = string.split(exampleString, ",")

local result = Vector3.new(tonum(separated[1]), tonum(separated[2]), tonum(separated[3]))

print(separated)

print(result)
1 Like