Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local enterNameEvent = ReplicatedStorage:WaitForChild("EnterName")
- local dialog = workspace.NPC.Head.Dialog
- local nameChoice = dialog:WaitForChild("DialogChoice")
- dialog.DialogChoiceSelected:Connect(function(player, choice)
- if choice == nameChoice then
- enterNameEvent:FireClient(player)
- end
- end)
- enterNameEvent.OnServerEvent:Connect(function(player, playerName)
- if typeof(playerName) ~= "string" then
- return
- end
- playerName = playerName:match("^%s*(.-)%s*$")
- if playerName == "" then
- return
- end
- -- Ограничиваем длину
- playerName = string.sub(playerName, 1, 20)
- -- Сохраняем имя только для этого игрока
- player:SetAttribute("DialogName", playerName)
- print(player.Name .. " ввёл имя: " .. playerName)
- end)
Advertisement
Add Comment
Please, Sign In to add comment