As before. What I'm trying to do is get a GUI to become transparent when the player presses "Left CTRL" and visible when they press "Left ALT". But with a catch, trying to make the loop, which I struggle with...
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(Key)
if Key == string.char(50) then
if script.Parent.BackgroundTransparency == 1 then
for i = 1,0.6,-0.1 do
script.Parent.BackgroundTransparency = i
wait(0.1)
end
end
elseif Key == string.char(52) then
if script.Parent.BackgroundTransparency == 0.6 then
for i = 0.6,1,0.1 do
script.Parent.BackgroundTransparency = i
wait(0.1)
end
end
end
end)
--string.char(52) = Left Alt
--string.char(50) = Left Ctrl

1 comment
I strongly suggest using UserInputService, as KeyDown is a deprecated method. Other than that I don't see anything that is incorrect, what isn't working exactly?