I am making a script where if you type "hello" and press enter in a text box, it undisables a script that adds 5 coins to a coins datastore. Here is the script that undisables the script: note: the script is in the workspace
game:GetService("UserInputService").InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Return then
if script.Parent.Text == "hello" then
print("worked")
workspace.dsactivatecoins5.Disabled = false
local particalsuccess = Instance.new("ParticleEmitter")
particalsuccess.Parent = game.workspace.tvscreencpp
particalsuccess.Name = "particle"
particalsuccess.Enabled = true
script.Parent.Parent.Frame.text.Text = "Great job! Now click the button that says 'teleport to example' Also, here are some coins!."
script.Parent.Parent.TextButton.Visible = true
wait(2)
particalsuccess.Enabled = false
script.Parent.Parent.yaycorrect.Visible = false
script.Parent.TextEditable = false
script.Disabled = true
end
if script.Parent.Text ~= "hello" then
print("DENIED")
local udidbad = Instance.new("Explosion")
udidbad.Name = "bad"
udidbad.Parent = workspace.tvscreencpp
script.Parent.Parent["no :("].Visible = true
udidbad.Position = workspace.tvscreencpp.Position
udidbad.BlastRadius = 20
wait(2)
udidbad:Destroy()
script.Parent.Parent["no :("].Visible = false
end
end
end)

2 comments
What's in the "dsactivatecoins5" script?
Also, I recommend not using UserInputService to detect when a user presses enter. See my answer for what to use instead.