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

UserInputService GUI Transparency problems. Any help here?

Asked by
Foridex 46
6 years ago
Edited 6 years ago
local player = game.Players.LocalPlayer
local gui = script.Parent
local Open = false

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.R then
        if (Open == false) then
            print("Open is False!")
            for i = 1,0,-0.1 do
                gui.BackgroundTransparency = i
                wait()
            end
            Open = true
            print("Open is now True!")
        elseif (Open == true) then
            print("Open is now True!")
            for k = 0,1,0.1 do
                gui.BackgroundTransparency = k
                wait()
            end
            Open = false
            print("Open is False!")
        end
    end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)
0
for i and k doesnt have a cooldown everytime the value increases so it instantaneously goes to 1. Consider placing a wait() below each “gui.BackgroundTransprency = yada-yada”. Rhythic 36 — 6y
0
I put a print at the first part of the script where it detects if Open is indeed false, and it worked there, but the other part of the script failed and didn't print anything Foridex 46 — 6y

Answer this question