Need help with selecting system

why is it saying there is nothing selected despite the fact that i am selecting a sprite ?

code:

SelectedSprite.Changed:Connect(function()
    for _, button in pairs(Buttons) do
        if button:IsA("Frame") and button.BorderSizePixel ~= 0 and button ~= SelectedSprite.Value then
            SelectUI.Deselect(button, PlaceButton)
        elseif button:IsA("Frame") and button == SelectedSprite.Value then
            SelectUI.Select(button, PlaceButton)
        end
        Mouse.Button1Down:Connect(function()
            if Mouse.Target ~= Buttons and button:IsA("Frame") then
                SelectUI.Deselect(button, PlaceButton)
                SelectedSprite.Value = nil
            end
        end)
    end
end)

module:

functions.Select = function(Button, PlaceButton)
    Tween(Button, 0.1, "Sine", "InOut", {BorderSizePixel = 5})
    
    PlaceButton.BackgroundColor3 = Color3.fromRGB(33, 244, 54)
    PlaceButton.Text = `Place {Button.Name}`
end

functions.Deselect = function(Button, PlaceButton)
    Tween(Button, 0.1, "Sine", "InOut", {BorderSizePixel = 0})
    
    PlaceButton.BackgroundColor3 = Color3.fromRGB(194, 194, 194)
    PlaceButton.Text = "No Sprite Selected"
end

1 Like