Need help with vault system

I’m trying to make a system where you can find a code and unlock a vault, and I’m having some trouble with a script, I’m a beginner dev and I don’t know where I messed up.

Script:

local code = game.ReplicatedStorage.Info.Code
local textbox = script.Parent

local newcode = tostring(code.Value)

textbox:GetPropertyChangedSignal("Text"):Connect(function()
	if textbox.Text == newcode then
		textbox.Parent.Parent.Parent.Parent:Destroy()
	end
end)

What is the issue here?

Do you get any errors in logs?

What is supposed to happen, and what happens instead?

3d element UI can’t be intreact unless making your own custom intreact (which replications to server)

try

local code = game.ReplicatedStorage.Info.Code.Value

i assume its a stringvalue :zany_face: :zany_face: :zany_face:

Players updating text only directly affect their own device. If you’re okay with the vault only opening for people who put in the code themselves, make sure this is a LocalScript or change the RunContext to Client. You may want to print out the string code variable to verify it’s what you expect. (just don’t include the print in the published game so players can’t cheese the vault)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.