So I'm making this game and the user has to enter a custom name, but whenever I test it and put a name, it always comes up with the response used when there is nothing there.
--things-- local WR = script.Parent.Parent:WaitForChild("Warning") local NM = script.Parent.Parent local NN = game.ReplicatedStorage:WaitForChild("NewName") --texts-- local preview = "My name is"..NN.Value local warning2 = "This field cannot be blank." --variables-- --script-- script.Parent.MouseButton1Click:Connect(function() if NM.Text ~= "" then script.Parent.Visible = false repeat wait() NN.Value = NM.Text until NN.Value == NM.Text for a = 1,#preview do WR.Text = string.sub(preview,1,a) wait() end wait(3) WR.Text = "" else script.Parent.Visible = false for a = 1,#warning2 do WR.Text = string.sub(warning2,1,a) wait() end wait(3.2) script.Parent.Visible = true end end)
--things-- local WR = script.Parent.Parent:WaitForChild("Warning") local NM = script.Parent.Parent local NN = game.ReplicatedStorage:WaitForChild("NewName") local warning2 = "This field cannot be blank." --variables-- local preview --script-- script.Parent.MouseButton1Click:Connect(function() if NM.Text ~= "" then script.Parent.Visible = false repeat wait() NN.Value = NM.Text until NN.Value == NM.Text preview = "My name is "..NN.Value for a = 1,#preview do WR.Text = string.sub(preview,1,a) wait() end wait(3) WR.Text = "" else script.Parent.Visible = false for a = 1,#warning2 do WR.Text = string.sub(warning2,1,a) wait() end wait(3.2) script.Parent.Visible = true end end)
you seted nm after setting the preview value, that is, the preview is not changed.
Hope this helps