Hi guys, I am trying to figure out how to make it so that when players enter a nickname for there characters it goes to the next screen. I have some of the nickname script already. It’s just I need help trying to get the user input so my nickname script can have something to hold.
I don’t know if I am on the right track of using user input here and the nickname script. or if there is a simpler way to get the text entered by the user.
Nickname script:
local HoldName = game:GetService("ServerStorage"):WaitForChild("holdname")
local Name = script.Parent.Parent.ReplicatedFirst.LocalScript.StartScreen.ChoiceFrame.NameLabel.Nametext
game.Players.PlayerAdded:Connect(function(player)
local characterName = Instance.new("StringValue", player)
end)
game.ReplicatedStorage.CharacterName.OnServerEvent:Connect(function(player, name)
print(name)
if game:GetService('TextService'):FilterStringAsync(name,player.userId,Enum.TextFilterContext.PublicChat):GetNonChatStringForBroadcastAsync()== name then
characterName = name
print(characterName)
local head = player.Character.Head
local clonedtag = head:FindFirstChild("holdname") or HoldName:Clone()
clonedtag.Name = characterName
clonedtag.Parent = head
else
error('That name is NOT allowed!')
end
end)
Choicescript(local script):
local userInput = game:GetService("UserInputService")
local create = script.Parent.Parent.Frame
local Name = script.Parent.NameLabel.Nametext
local Namelabel = script.Parent.NameLabel
local Textlabel = script.Parent.NameLabel.TextLabel
local text = "What is your name?"
local FirstFinished = script.Parent.Parent.Frame.LocalScript.FirstScreenFinished
FirstFinished.Event:Wait()
for i = 1, #text do
script.Parent.NameLabel.Text = string.sub(text,1,i)
local cor = coroutine.wrap(function()
local sound = Instance.new("Sound")
sound.Volume = .5
sound.SoundId = "rbxassetid://3682239219"
sound.Parent = script.Parent.Parent
sound:Play()
sound.Ended:wait()
sound:Destroy()
end)
cor()
wait()
end
userInput.TextBoxFocused = Name
userInput:GetLastInputType()
script.SecondScreenFinished:Fire()
oh and just so you know the second screen is supposed to fire this screen(local script):
local text = "What moves you forward?"
local Courage = script.Parent.Parent.Courage
local SecondFinished = script.Parent.Parent.Parent.ChoiceScript.SecondScreenFinished
SecondFinished.Event:Wait()
for i = 1, #text do
script.Parent.Parent.ChoiceLabel.Text = string.sub(text,1,i)
local cor = coroutine.wrap(function()
local sound = Instance.new("Sound")
sound.Volume = .5
sound.SoundId = "rbxassetid://3682239219"
sound.Parent = script.Parent.Parent
sound:Play()
sound.Ended:wait()
sound:Destroy()
end)
cor()
wait()
end
for i = 1, 0, -.09 do
Courage.TextTransparency = i
wait(.2)
end