Find tostring(v) parent?

Trying to find out how to get the parent of a tostring?

I know that you cannot get it because it returns with nil, and if there is a tostring() v it returns with an instance?

how would I get around this?

example

template.scriptLocation.Text = v.Parent
template.scriptLocation.Text = tostring(v).Parent
--//both error

first off what is v?..
also, v.Parent (if v is an instance) returns an Instance, not a string so it’s going to error because you’re trying to set .Text to an Instance.

tostring() takes a set of numbers and turns it into a string
for example 123 turns into “123” if you use tostring()

for _,v in pairs(game:GetDescendants()) do
		local success, isScript = pcall(function()
			return v:IsA("BaseScript")
		end)

		if success and isScript then
			wait(0.1)
			print(v)
			
			
			local template = newTemplate:Clone()
			template.Name = tostring(v)
			template.scriptNameType.Text = tostring(v)
		--	template.scriptLocation.Text = v.Parent
			template.Parent = ScrollingFrame
		end
	end

what is this for? you should never loop through game, especially with GetDescendants it’ll crash (at least for me)

why are you doing template.Name = tostring(v) why not template.Name = v.Name?
same for where you’re trying to set the text

Doesnt crash for me, and this worked thank you