Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Unable to cast token to token?

Asked by
unmiss 337 Moderation Voter
8 years ago

Unsure what this error means. I have a table of buttons. I'm checking if they are clicked, and if they are, I will move the bar for selections under the button. I'm getting a strange error Unable to cast token to token

local gui = script.Parent
local holder = gui.Holder
local plr = game.Players.LocalPlayer

local buttonhol = holder.ButtonHolder
local menuhol = buttonhol.MenuHolder

local topbuttons = {}

local sine = Enum.EasingStyle.Sine
local out = Enum.EasingDirection.Out

for _,v in pairs (buttonhol:GetChildren()) do
    if v:IsA("TextButton") then
        print(v.Name)
        table.insert(topbuttons, v)
    end
end
local sbar = buttonhol.selectedbar

for _,b in pairs (topbuttons) do
    b.MouseButton1Click:connect(function()
        print("clicked")
        print(b.Position.X.Offset)
        local pos = UDim2.new(0, b.Position.X.Offset, 1, 0)
        sbar:TweenPosition(pos, sine, out, 1, true)
    end)
end

Answer this question