How do i use a parameter's parent name as a way to go to a specific location

So how do I say this…
basically, you’ll get it by the script

local tool = script.Parent

tool.Handle.Touched:Connect(function(a)
	local B = a.Parent.Name
	tool.Activated:Connect(function()
		if a.Parent.Humanoid then
			game.Players.B.PlayerGui.RentTest.RentAmount.RentAmountLeftToPay.Value = 0
		end
	end)
end)

I’ve tried putting it in brackets and stuff and it’s not working?
Also, I want to use the parameter parent’s name in this case

Change

game.Players.B.PlayerGui

To

game.Players[B].PlayerGui