Hello, I am Making A Discord Application But On Roblox and I need to take users discord id and discord id is 18 characters so I would like to limit the user to only enter 18 characters, I made a script about it but there it is not working somehow
local submitbutton = script.Parent.Submit
local ws = require(script.Parent.WebhookService)
local url = "can't give"
local Players = game:GetService("Players")
local Hellotext = script.Parent.UserName
--local optionaltextval = script.Parent.PlayerSaying
local userid =game:GetService("ReplicatedStorage"):WaitForChild("DiscordId")
local PlayerSaid = game:GetService("ReplicatedStorage"):WaitForChild("PlayerSaying")
local TweenService = game:GetService("TweenService")
local textboxclosed = UDim2.new(1.5, 0,0.331, 0)
local discordidclosed = UDim2.new(1.5, 0,0.808, 0)
local submitshowppsitoin = UDim2.new(0.063, 0,0.422, 0)
local DiscordButtonTween = TweenService:Create(script.Parent.DiscordID, TweenInfo.new(1), {Position=discordidclosed})
local textboxTween = TweenService:Create(script.Parent.TextBox, TweenInfo.new(1), {Position=textboxclosed})
local submitshow = TweenService:Create(script.Parent.SubmittedText, TweenInfo.new(1), {Position = submitshowppsitoin})
local peoplewhoapplied = {}
local Min = 10^17.99
local Max = 10^18
local stirnglen = string.len(userid.Value)
submitbutton.MouseButton1Click:Connect(function(player)
for _, p in pairs(Players:GetPlayers()) do
local useridint = tonumber(userid.Value)
if (tonumber(userid.Value))then
if table.find(peoplewhoapplied, useridint) then
p:Kick("Apparently The Id You Entered Is Already Verified, Screenshot This If Your Not Verified")
elseif not table.find(peoplewhoapplied, userid.Value) then
--if string.len(userid.Value) >=10^18 then
if stirnglen==18 then
print(useridint)
if userid.Value=="" then
submitbutton.Text="Error"
wait(1.5)
submitbutton.Text="Submit"
elseif userid.Value~="" then
submitbutton.Text="Submitted"
local playername = p.Name
local playeruserid = p.UserId
textboxTween:Play()
DiscordButtonTween:Play()
submitshow:Play()
submitbutton.Visible=false
local fields = {
{
['name'] = playername.." said nothing",
['value'] = "Submitted By: "..playername.." | "..playeruserid,
['inline'] = true
}
}
local digit = math.clamp(useridint,1000000000000000000,999999999999999999)
print(userid)
ws:createEmbed(url, "New Application", "Submitted By <@"..userid.Value..">", fields)
wait(3.5)
--p:Kick("Application Submitted Succesfully")
end
elseif stirnglen~=18 then
submitbutton.Text="Digit Number Should Be 18 digits"
print(useridint)
wait(2.5)
submitbutton.Text="Submit"
end
end
else
submitbutton.Text="Error"
wait(1.5)
submitbutton.Text="Submit"
end
end
end)