Well, I explain, when you start, you start with a default key “M”, but it does not detect it, and you have to change it with this
And when changing the keycode for a different one, a signal is sent to a stringValue to the client
But what I want it to do is that when starting it detects the stringValue, because it does not detect it when entering, and for it to detect it, you must change it with the GUI of the image that I put, ¿what do I do?
local Open = false
local keyText = ""
local keyText2 = ""
local MenuKey = game.Players.LocalPlayer:WaitForChild("Keys"):WaitForChild("MenuKey")
local MenuKey2 = game.Players.LocalPlayer:WaitForChild("Keys"):WaitForChild("MenuKey2")
MenuKey:GetPropertyChangedSignal("Value"):Connect(function()
keyText = MenuKey.Value
keyText2 = MenuKey2.Value
end)
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:connect(function(key)
if (key.KeyCode.Name == keyText) or (key.KeyCode.Name == keyText2) then
if Open then
Open = false
script.Parent.Sombras.Visible = false
else
Open = true
script.Parent.Sombras.Visible = true
end
end
end)