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

Why does this value become nil when I die?

Asked by
poke7667 142
6 years ago

I was trying to use a custom keybind from a textbox in my gui and whenever I die, it says that it's Parent (An ImageLabel) is a nil value. I don't know why this is happening.

My code:

local g;
g = game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessed)
    -- Line below errors --
    if Spells.Freeze.Bind.Text:len() == 1 or Spells.Explosion.Bind.Text:len() == 1 then 
        if input.KeyCode == Enum.KeyCode[Spells.Freeze.Bind.Text:upper()] then
            -- Code here
        end
    end
end)

Answer this question