[SOLVED] UI Stroke transparency not working right

Another day, another forum. And the next one is pretty simple, but aggravating for the eye to see when transitioning between different scenes. :eyes:

To put it simply, the issue is basically around a UI Stroke transparency change, that for whatever reason, won’t stay at a transparency of 1. (This is even though the property clearly states it’s one). Something I find strange though is that when I manually put it (in-game) to 1 (Even though it’s already 1) all of a sudden it’s transparent.

robloxapp-20240220-2034583.wmv (1.3 MB)

Tried looking it up, fixing it myself, and using other ways around it, but it still doesn’t work.

Local Script:

-- All of the quickmenu buttons
local returnbutton = script.Parent.returnbutton
local historybutton = script.Parent.history

local QuickMenu = script.Parent
local camera = workspace.Camera

local passed = {}

-- Transitioning back.
returnbutton.MouseButton1Click:Connect(function()
    script.Parent.Parent.QuickMenuTransition.Visible = true
    
    script.Parent.history.Selectable = false
    script.Parent.load.Selectable = false
    script.Parent.mainmenu.Selectable = false
    script.Parent.quit.Selectable = false
    script.Parent.returnbutton.Selectable = false
    script.Parent.save.Selectable = false
    script.Parent.settings.Selectable = false
    
    script.Parent.Parent.QuickMenuTransition.ImageTransparency = 0
    camera.CameraType = Enum.CameraType.Custom
    camera.CFrame = game.Players.LocalPlayer.Character:WaitForChild("Head").CFrame + Vector3.new(0, 0, 5)
    
    -- Make sure the ui element has 0 transparency (image or text)
    for i, v in pairs(script.Parent.Parent.QuickMenu:GetDescendants()) do
        if (v:IsA("ImageLabel") or v:IsA("ImageButton")) and vTrans.Imageparency == 0 then
            passed[v] = true
        elseif (v:IsA("TextLabel") or v:IsA("TextButton")) and v.TextTransparency == 0 and v.Parent ~= "HistoryManager" then
            passed[v] = true
        elseif v:IsA("UIStroke") and v.Parent.Parent.Name ~= "HistoryManager" and v.Transparency == 0  then
            passed[v] = true
        else
            passed[v] = false
        end
    end
    
    for i = 1, 10 do
        script.Parent.Parent.QuickMenuTransition.ImageTransparency = script.Parent.Parent.QuickMenuTransition.ImageTransparency + 0.1
        for i, v in pairs(script.Parent.Parent.QuickMenu:GetDescendants()) do
            -- Make sure the child is a UI element.
            if passed[v] == true then
                if v:IsA("ImageLabel") or v:IsA("ImageButton") then
                    v.ImageTransparency = v.ImageTransparency + 0.1
                elseif v:IsA("TextLabel") or v:IsA("TextButton") then
                    v.TextTransparency = v.TextTransparency + 0.1
                elseif v:IsA("UIStroke") then
                    print("Passed!")
                    v.Transparency = v.Transparency + 0.1
                end
            end
        end
        task.wait(0.05)
    end
    script.Parent.Parent.QuickMenuTransition.Visible = false
    script.Parent.history.Selectable = true
    script.Parent.load.Selectable = true
    script.Parent.mainmenu.Selectable = true
    script.Parent.quit.Selectable = true
    script.Parent.returnbutton.Selectable = true
    script.Parent.save.Selectable = true
    script.Parent.settings.Selectable = true
    passed = {}
end)

historybutton.MouseButton1Click:Connect(function()
    script.Parent.History.Visible = true
    for i, v in pairs(script.Parent:GetChildren()) do
        if v:IsA("Frame") and v.Name ~= "History" and not v:IsA("LocalScript") then
            v.Visible = false
        end
    end
end)
2 Likes

Sorry if you have to download the video by the way.

Every time LMB is pressed, you run this loop. You don’t yield or break the loop when it’s pressed again. So you’ll have loops that overlap, and interfere.

But doesn’t disabling .Selectable remove the possibility of this happening? Regardless, I’m only pressing it once and it’s still causing the same problem so that’s probably not it. Though .Selectable is for supposed gamepad, it’s been working for me though.

Send me the rbxl file, I’ll fix it

Here:

(Just click history and see what happens when you press return)

uistrokeissue.rbxl (84.3 KB)

Setting the transparency to 1 after your for loops works. I’d suggest you do that

Thanks, didn’t know it was that simple. But I did have to sort of rework the code to make this work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.