How can I change the keyboardcode of a ProximityPrompt with a text box?

Well, I have a key exchange system connected to a string value, the string value stores the key that changed and I want that letter to be detected by the proximity indicator, what do I do?

local KeyText = ""

local Interactive = game.Players.LocalPlayer:WaitForChild("Keys"):WaitForChild("InteractiveKey")


KeyText = Interactive.Value


local proximity = script.Parent.ProximityPrompt

proximity.KeyboardKeyCode = KeyText

You are on the right track, but I think what you should do instead is create the proximity varaible above the GetPropertyChangedSignal event and in the event, instead of changing the KeyText, just change the KeyboardKeyCode

local Interactive = game.Players.LocalPlayer:WaitForChild("Keys"):WaitForChild("InteractiveKey")

local proximity = script.Parent.ProximityPrompt


proximity.KeyboardKeyCode = Interactive.Value


Would be simpler to do it like this I believe, and your code would’ve worked one time anyways since its’ not in an event

It doesn’t work for me, I’m interested in the Remote Event, how do I do it?

I think it’s probably not working since KeyboardKeyCode expects a keycode, and you’re giving it a string instead, maybe try thsi for the event


local key = Enum.KeyCode[Interactive.Value]

if not key then return end

proximity.KeyboardKeyCode = key


Just to confirm, Interactive is a StringValue?

Yes, it is a stringValue, I want to use it to collect Tools or open doors

I think the code I’ve provided should work for StringValues then, it gets the KeyCode related to that key if it exists, if it doesn’t, don’t continue, if it does, set it to the proximity prompt.

If that doesn’t work, maybe try giving it an Uppercase letter via

local key = Enum.KeyCode[string.upper(Interactive.Value)]

The key system had already put the Uppercase on it

robloxapp-20210325-0137475.wmv (966.4 KB)

The issue with doing it with a remoteevent is that it would change it for everyone, did you try out the code I mentioned in my second reply?

If it didn’t work, I have a few things you could do.

Check if the event is actually firing via a print inside of the event itself

Are you getting any errors?

The second method didn’t really work

Oh Im sorry. No, I did not get any error in output

Could you add a print(Interactive.Value) inside of the event to see what it is receiving?

It just doesn’t show anything on the output or when pressing F9

Then that’s the issue, it’s not running the event, which now I realise why, you used Value instead of Text, since this is a text box, maybe make it listen for Text since this is a text box?


local key = Enum.KeyCode[Interactive.Text]

if not key then return end

proximity.KeyboardKeyCode = key


It also does not work, I put value because in another key change I use it and it works

Something else is probably wrong then, Was it printing something when you changed it to Text or nothing? What even is InteractiveKey? A StringValue or a Textbox or something else?

Interactive key is a stringValue

The stringValue that I have used as keys

local Players = game:GetService(“Players”)

	local Folder ="Folder")
	Folder.Name = "Keys"
	Folder.Parent = player
	local MenuKey ="StringValue")
	MenuKey.Name = "MenuKey"
	MenuKey.Parent = Folder
	MenuKey.Value = "M"
	local MenuKey2 ="StringValue")
	MenuKey2.Name = "MenuKey2"
	MenuKey2.Parent = Folder
	MenuKey2.Value = ""
	local InteractiveKey ="StringValue")
	InteractiveKey.Name = "InteractiveKey"
	InteractiveKey.Parent = Folder
	InteractiveKey.Value = "F"


So something isn’t updating InteractiveKey’s value then if when it was set to get signals when Value is changed it got nothing, how are you changing the value?

The value of the string if it changes, I have checked it

local keyText = ""

local CInteracuar = script.Parent.MenuKeyPrimero


local text = CInteracuar.Text:upper()

CInteracuar.Text = text:sub(1, 1)

keyText = text

local InteractiveKey = game.Players.LocalPlayer:WaitForChild("Keys"):WaitForChild("InteractiveKey")

InteractiveKey.Value = keyText:sub(1, 1)