--I've been trying to get a GUI textbox to do something when it has a certain text
--CODEN is a ScreenGUI, VERIFICATION is a frame and ENTERHERE is a textbox
--IAMLOCKED is a part within the workspace
--this is the script:
local plr=game.Players.LocalPlayer
local code=plr.PlayerGui.CODEN.VERIFICATION.ENTERHERE.Text
if code=='ohhellothere' then game.Workspace.IAMLOCKED.CanCollide=false end
This does not work since the if statement only ran once. The code is not under an event or loop. Here is your code. It also doesn’t work since you set the code variable to the box’s Text, which only sets the variable to the current text at assigning the variable. Instead, set the variable to the object and set the .Text later on.
loca plr = game:GetService('Players').LocalPlayer local plrGui = plr:WaitForChild'PlayerGui' local codeBox = plrGui.CODEN.VERIFICARION.ENTERHERE codeBox:GetPropertyChangedSignal('Text'):Connect(function() if codeBox.Text == 'ohhellothere' then game.Workspace.IAMLOCKED.CanCollide = false end end)