#Need help with random name generator

87 messages · Page 1 of 1 (latest)

manic bloom
#

Hi potato, this is an extremely simple script

#

you would have a table with names

#

and another table with last names

#

so 2 tables right

#

every time the player joins get a random value from from the names table

#

and another random value from the last names table

#

apply those values in either an attribute, or an object value, whatever you decided to use for the player name and last name storage 🙂

#

that's literally it

worn anvil
#

@manic bloom Currently I have 2 folders in server storage, in them are 50 first name values and 50 last name values already named

#

Did i do it right

manic bloom
#

I would have not done that but you can do exactly the same thing

worn anvil
#

sorry i dont scro[t

manic bloom
#

it's fine

worn anvil
#

and theres no tutorials

#

this is all i have idk anything

#
    local serverStorage = game:GetService("ServerStorage")
    local FirstNamesFold = serverStorage.FirstNames
    local LastNamesFold = serverStorage.LastNames

    local FirstNameRand = math.random(1,50)
    local LastNameRand = math.random(1,50)

    local FirstName = FirstNamesFold:FindFirstChild(FirstNameRand).Value
    local LastName = LastNamesFold:FindFirstChild(LastNameRand).Value
    
    local Player = game.Players.LocalPlayer
    Player.Parent = workspace

    Player.Name = FirstName.." "..LastName 

end
manic bloom
#

okay so 2 folders right?

worn anvil
manic bloom
#

that'll error

#
    local FirstName = FirstNamesFold:FindFirstChild(FirstNameRand).Value
    local LastName = LastNamesFold:FindFirstChild(LastNameRand).Value
#

see this? FindFirstChild takes a string

#

you are passing a number

#

so what you want to do is

worn anvil
#

yeah

#

I have like Folder. Value (Named with the number) and the value is the name

manic bloom
#
    local FirstName = FirstNamesFold:GetChildren()[FirstName].Value
    local LastName = LastNamesFold:GetChildren()[LastName].Value
#

GetChildren will return an array

#

and you can index to an array with bracketsd []

worn anvil
#

ok

manic bloom
#

and that's it

#

you did great!

worn anvil
#

wait

manic bloom
#

only that minor thing

worn anvil
#

i have the orange

#

tho

manic bloom
#

I don't get it

worn anvil
manic bloom
worn anvil
#

ohhh

manic bloom
#

yah

worn anvil
#

should i remove end?

manic bloom
#

;-;

worn anvil
#

its red

manic bloom
#

you have FirstNameRand

#

you passed FirstName

worn anvil
#

o

#

is firstname supposed to be before firstname rand

manic bloom
#

you passed FirstName

#

it does not exist

worn anvil
#

oh

manic bloom
#

you defined your random number as FirstNameRand

#

so pass that

worn anvil
#
    local serverStorage = game:GetService("ServerStorage")
    local FirstNamesFold = serverStorage.FirstNames
    local LastNamesFold = serverStorage.LastNames

    local FirstNameRand = math.random(1,50)
    local LastNameRand = math.random(1,50)

    local FirstName = FirstNamesFold:FindFirstChild(FirstNameRand).Value
    local LastName = LastNamesFold:FindFirstChild(LastNameRand).Value

    local FirstName = FirstNamesFold:GetChildren()[FirstName].Value
    local LastName = LastNamesFold:GetChildren()[LastName].Value
    
    local Player = game.Players.LocalPlayer
    Player.Parent = workspace

    Player.Name = FirstName.." "..LastName 

end
#

good?

manic bloom
#

why do you have 2 pairs?

worn anvil
#

o

manic bloom
#
    local FirstName = FirstNamesFold:FindFirstChild(FirstNameRand).Value
    local LastName = LastNamesFold:FindFirstChild(LastNameRand).Value

    local FirstName = FirstNamesFold:GetChildren()[FirstName].Value
    local LastName = LastNamesFold:GetChildren()[LastName].Value
worn anvil
#

oop

manic bloom
#

Dude I cannot make it simpler man

#

literally

worn anvil
#

lol

#
    local serverStorage = game:GetService("ServerStorage")
    local FirstNamesFold = serverStorage.FirstNames
    local LastNamesFold = serverStorage.LastNames

    local FirstNameRand = math.random(1,50)
    local LastNameRand = math.random(1,50)

    local FirstName = FirstNamesFold:GetChildren()[FirstName].Value
    local LastName = LastNamesFold:GetChildren()[LastName].Value


    local Player = game.Players.LocalPlayer
    Player.Parent = workspace

    Player.Name = FirstName.." "..LastName 

end
manic bloom
#

I just told you to replace FindFirstChild with what I gave you

worn anvil
#

i did

manic bloom
#

you are passing first name

#

n()[FirstName].Value

worn anvil
#

ok

manic bloom
#

pass FirstNameRand

worn anvil
#

i told u

#

i dont script

#

so u want me to add an N infront of the ()

manic bloom
#

does not mean you cannot follow instructions ;-;

#

no!

manic bloom
#

Dude!

#

wtf 😅

worn anvil
#

wtf do u mnean pass i t

#

@tiny sluice

tiny sluice
#

just use a table of the name

worn anvil
#

studio** You are now Level 12! **studio

tiny sluice
#

s

worn anvil
#

can u talk to this clueless dev

#

i know nothiin