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!
I want it to go to the next frame when the username you enter is right -
What is the issue? Include screenshots / videos if possible!
I’m trying to make a username GUI that goes to the next frame if the player username is right that’s on the server but when I hit the enter button it prints out saying the username doesn’t exist when I enter the right username
here’s 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 function onValidationResult(success)
if success then
script.Parent.NameFrame.Visible = false
nextFrame.Visible = true
else
print("Username not found!")
end
end
local function validateUsername()
local enteredUsername = textBox.Text
validateUsernameEvent:FireServer(enteredUsername)
end
continueButton.MouseButton1Click:Connect(validateUsername)
validateUsernameEvent.OnClientEvent:Connect(onValidationResult)
and hers 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)