function generateMedKit(name,XYZ)
local MedKits = game.ServerStorage.MedKits.name
MedKits.Position = XYZ
MedKits.Parent = game.Workspace
end
generateMedKit("Med1","Vector3.new(463.39, 28.452, 220.52)")
generateMedKit("Med2","Vector3.new(463.39, 28.452, 208.84)")
generateMedKit("Med3","Vector3.new(463.39, 28.452, 196.33)")
I understand what is not working here, but I am not sure how to fix it. The variable is being set to "game.ServerStorage.MedKits.name", but I need the script to make "name" whatever I write within the argument like "Med1" that way for each function I call I can select a different part within the ServerStorage.
function generateMedKit(name,XYZ)
local partName = name
local MedKits = game.ServerStorage.MedKits.partName
MedKits.Position = XYZ
MedKits.Parent = game.Workspace
end
generateMedKit("Med1","Vector3.new(463.39, 28.452, 220.52)")
generateMedKit("Med2","Vector3.new(463.39, 28.452, 208.84)")
generateMedKit("Med3","Vector3.new(463.39, 28.452, 196.33)")
I also tried doing it this way trying make "partName" a variable of the "name" I wanted, but it didn't work.
Sorry if it is hard to understand what I'm asking, I just started scripting and can't explain this stuff well yet. I'm not even sure if any of this script could even work.

4 comments
Edit the post so the code is within a code block
you want it to find the medkit with the specific name?
or generate a medkit with the name?
I have a group called MedKits with Med1 through Med3 within it and I need to select one Med at a time. So yes I am trying to select a specific Med