There were multiple things wrong with the formatting with your code that you supplied
Step through explanation:
Your code:
local pos1 = "{0.014, 0},{0.03, 0}"
local pos2 = "{15, 15},{15, 15}"
Assuming these are meant to be UDim2 values for a GUI element position?. The way you've formatted these are read by Luau (or simply put Roblox Lua) would be interpreted as a string and not an UDim value.
The correct way to format UDim Values is like this:
local pos1 = UDim2.new(0.014, 0, 0.03, 0)
local pos2 = UDim2.new(15, 15, 15, 15)
Moving on to the next problem we come to this line:
if bvalue.Value = true then
in Lua this would be setting the bvalue.Value to equal true rather than checking it if is true or not!.
To fix this simply do this:
if bvalue.Value == true then
Also the error code is happening on this line. The Lua interpreter is expecting you setting your bvalue.Value to equal true, but it finds the then at the end of the line so it simply spits out the problem and thats the error you got!.
The last problems is with these lines:
maingui.Position = UDim2.fromOffset("pos1")
bvalue.Value = false
else
maingui.Position = UDim2.fromOffset("pos2")
bvalue.Value = true end end)
This will also error out due to you passing a string and not your position values you set above. the function UDim2.fromOffset() expects a Vector2 and not a string value. Here you're simply feeding it with a string!.
To fix these i would change it to :
maingui.Position = pos1
bvalue.Value = false
else
maingui.Position = pos2
bvalue.Value = true
Full Code:
local maingui = script.Parent.Parent.main
local bvalue = script.active
local pos1 = UDim2.new(0.014, 0, 0.03, 0)
local pos2 = UDim2.new(15, 15, 15, 15)
script.Parent.MouseButton1Click:Connect(function()
if bvalue.Value == true then
maingui.Position = pos1
bvalue.Value = false
else
maingui.Position = pos2
bvalue.Value = true
end
end)
Hope this helps! :)
if you have any problems or questions, let us know! :)