Why my name for the new part is not working when trying to do function

Hey I kind of need help I watched some videos about arguments and stuff like that and still cant find the answer please help

local function Try(name)

local my = Instance.new(“Part”)

my.Name = Yeah

my.BrickColor = BrickColor.new (“Really red”)

my.Transparency = 0.5

my.Parent = workspace

end

Try(Uff)

Try(Please)

also what im trying to do is make the names for the parts

and the “(Uff) and (Please)” are the names im trying to make it and try is the function

You need to the yeah put it in quotations

First of all, I don’t understand most of the code.
When you said
“my.Name = Yeah”
I think it should be my.Name = True
There are multiple mistakes in this that makes it not work.
I’m not the best at scripting, but this looks like a jumble of words to me.

And next time you post code can you please put it in a code box,like this:

--Code Block
--Eg.
local yes = 5

my bad this my 2nd day trying to learn so ill try

also I thought you you have to name your Part if you want but ill try and I used random words for my function and a random word “my” to store it in I didnt paste it in here right

I advise you not to write my.Name = Yeah. because whenever you call a function, the function will create Part ONLY with the name “Yeah”. Use the name parameter that you added to your function. I suggest a script:

function Try(name)

local my = Instance.new(“Part”)

my.Name = name

my.BrickColor = BrickColor.new (“Really red”)

my.Transparency = 0.5

my.Parent = workspace

end

Try(“Yeah”)
Try(“Uff”)
Try(“Please”)

I hope it works

I advice you to read about Functions in Developer Hub https://developer.roblox.com/en-us/articles/Function

1 Like

Thanks bro it worked you the goat