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:

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

Answer this question