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)
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)