Attempt to call a table value error when im not using tables?

  1. What do you want to achieve?
    A menu where you can play or select a team.
  2. What is the issue?
    I get this error in the output:
    “Players.airsoft561.PlayerGui.ScreenGui.function:34: attempt to call a table value”
  3. What solutions have you tried so far?
    Tried to use udim, failed, miserably.

Code:

-- [ MAIN VARIABLES ] --

local playb = script.Parent.MainFrame.playbutto

local teamb = script.Parent.MainFrame.teambutton

local mainframe = script.Parent.MainFrame

local teamframe = script.Parent.TeamFrame

local diahb = teamframe.diahheria

local poopb = teamframe.poop

local smallpb = teamframe.smallp

local backb = teamframe.back

local tweenService = game:GetService("TweenService")

-- [ MAIN CODE ] --

playb.MouseButton1Click:Connect(function()

mainframe:TweenPosition(UDim2.new(1, 1, 0))

end)

teamb.MouseButton1Click:Connect(function()

mainframe:TweenPosition(UDim2.new(0, 1, 1))

wait(0.5)

mainframe.Visible = false

wait(0.1)

teamframe:TweenPosition(UDim2.new(0, 0, 0))

teamframe.Visible = true

wait(0.4)

end)

teamframe.back.MouseButton1Click:Connect(function()

teamframe:TweenPosition(UDim2(0, 1, 1))

wait(0.5)

teamframe.Visible = false

wait(0.1)

mainframe:TweenPosition(UDim2.new(0, 0, 0))

teamframe.Visible = true

print("clicked")

end)

(dont question the variable names, im making a poop game)

Udim2.new should have 4 values inside it:

udim2.new(0,0,0,0) -- First is X Scale, second is X offset, third is Y scale, fourth is Y offset

You may also want to read the documentation of TweenPosition to add more custom options such as time and tween type: GuiObject | Documentation - Roblox Creator Hub

You’re using UI Tweening incorrectly.