Humm not sure but might be the fact that one condition being true, leads the to other to be true as well, which leads the first one to be true and so forth... I doubt that its the problem but the simple IF statement seems wrong to me... To my eyes it'll do the following:
At first the frame is shown
IF is shown THEN hide so it's hiddent but since
IF hidden then show well it's shown again.
I would do the following ( The frame is shown by default)
Code:
Toggle_val = 1
function ToggleTitanDiscordFrame(frame)
if(frame:IsVisible() and Toggle_val == 1) then
frame:Hide();
Toggle_val = 0
elseif Toggle_val == 1 then
frame:Show();
end
Toggle_val = 1
end
The frame is visible by default, so (frame:IsVisible() and Toggle_val == 1) will return true, so it will hide it and set toggle_val to 0. Then it checks the second condition, Toggle_val == 1, which will return false, so it won't show the frame. Then the function sets Toggle_val to 1 again. So now the frame is hidden and toggle_val is equal to 1. You use the function again, but this time (frame:IsVisible() and Toggle_val == 1) will return false since the framse is hidden, but Toggle_val == 1 will return true since we set it to 1 the ast time we used the funciton, so it will hide the frame.
Hope that is the answer to your problems.
Good luck!