You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
when you enter the playerusername thats on the server it will go to the next frame -
What is the issue? Include screenshots / videos if possible!
I’m trying to make a player username gui that when you enter the player username name it will go to the next frame but when I enter the player username it doesn’t go to the next frame here my client script
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local validateUsernameEvent = ReplicatedStorage:WaitForChild("ValidateUsernameEvent")
local textBox = script.Parent.Parent.Ordering.NameFrame.ImageLable:WaitForChild("TextBox")
local nextFrame = script.Parent:FindFirstChild("OrderFrame")
local continueButton = script.Parent.NameFrame.ImageLable:FindFirstChild("enter")
local pressedEnter = false
local function onValidationResult(success)
if success then
script.Parent.NameFrame.Visible = false
nextFrame.Visible = true
else
print("Username not found!")
end
end
textBox.FocusLost:Connect(function(enterPressed)
if enterPressed then --checks if it already pressed enter, otherwise it will return nil
pressedEnter = true
end
end)
local function validateUsername()
if not pressedEnter then return end
local enteredUsername = textBox.Text
validateUsernameEvent:FireServer(enteredUsername)
end
continueButton.MouseButton1Click:Connect(validateUsername)
validateUsernameEvent.OnClientEvent:Connect(onValidationResult)
and here is my server script
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local validateUsernameEvent = ReplicatedStorage:FindFirstChild("ValidateUsernameEvent")
local function validateUsername(player, enteredUsername)
local targetPlayer = Players:FindFirstChild(enteredUsername)
if targetPlayer then
validateUsernameEvent:FireClient(player, true)
else
validateUsernameEvent:FireClient(player, false)
end
end
validateUsernameEvent.OnServerEvent:Connect(validateUsername)